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

Andrew Donnellan andrew.donnellan at au1.ibm.com
Mon Mar 21 11:26:26 AEDT 2016


On 21/03/16 11:17, Cyril Bur wrote:
> 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>

Looks good!

Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan at au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited



More information about the Skiboot mailing list