[Skiboot] [PATCH] external/common: Fix callers of file_init_path()

Stewart Smith stewart at linux.vnet.ibm.com
Thu Mar 31 16:11:03 AEDT 2016


Cyril Bur <cyril.bur at au1.ibm.com> writes:
> The arch_flash_init() in arch_flash_x86.c doesn't actually check the return value
> of file_init_path(), rather it is comparing the returned structure against NULL.
> It is unsafe (and incorrect at the moment) to assume that file_init_path will
> NULL this value on failure, it doesn't have to as it returns a value to
> indicate success or failure.
>
> The arch_flash_init() in arch_flash_powerpc.c calls file_init_path() through
> another function which will return a pointer (or NULL on failure), this
> function doesn't explicitly NULL its return pointer in the case that
> file_init_path() fails. It has initialised the pointer to NULL so the case may
> be less severe (compared to the arch_flash_x86 problem) as file_init_path()
> shouldn't have changed it on failure case, however, assuming that it won't
> is unsafe. It is best to explicitly NULL the return pointer if file_init_path()
> returns a failure.
>
> Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
> ---
>  external/common/arch_flash_powerpc.c | 4 +++-
>  external/common/arch_flash_x86.c     | 5 +++--
>  2 files changed, 6 insertions(+), 3 deletions(-)

Thanks, merged as of 145312a

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list