[Skiboot] [PATCH] external/pflash: Fix non-zero return code for successful read when size%256 != 0

Stewart Smith stewart at linux.vnet.ibm.com
Fri Dec 1 18:22:51 AEDT 2017

Suraj Jitindar Singh <sjitindarsingh at gmail.com> writes:
> When performing a read the return value from pflash is non-zero, even for
> a successful read, when the size being read is not a multiple of 256.
> This is because do_read_file returns the value from the write system
> call which is then returned by pflash. When the size is a multiple of
> 256 we get lucky in that this wraps around back to zero. However for any
> other value the return code is size % 256. This means even when the
> operation is successful the return code will seem to reflect an error.
> Fix this by returning zero if the entire size was read correctly,
> otherwise return the corresponding error code.
> Fixes: e1cf130d ("external/pflash: Remove use of exit() and fix memory leaks")
> Reported-by: Pridhiviraj Paidipeddi <ppaidipe at linux.vnet.ibm.com>
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh at gmail.com>
> ---
>  external/pflash/pflash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Merged to master as of 535d86ee98935793c0a03eb0ced6b206ce04825c

Stewart Smith
OPAL Architect, IBM.

More information about the Skiboot mailing list