[Skiboot] [PATCH] mambo: Add NULL checks and error messages

Alastair D'Silva alastair at au1.ibm.com
Mon Jul 11 14:13:00 AEST 2016


On Mon, 2016-07-11 at 11:35 +1000, Cyril Bur wrote:
> While it extremely unlikely that these paths will ever by triggered
> the error message could be useful to help diagnose a broken system.
> 
> This patch also fixes coverity issue 127700
> 
> Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
> ---
>  platforms/mambo/mambo.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/platforms/mambo/mambo.c b/platforms/mambo/mambo.c
> index 154c734..69e0796 100644
> --- a/platforms/mambo/mambo.c
> +++ b/platforms/mambo/mambo.c
> @@ -197,6 +197,12 @@ static void bogus_disk_flash_init(void)
>  
>  		bl = zalloc(sizeof(struct blocklevel_device));
>  		bdi = zalloc(sizeof(struct bogus_disk_info));
> +		if (!bl || !bdi) {
> +			free(bl);
> +			free(bdi);

This looks like it can result in a free attompt on a NULL pointer.

-- Alastair D'Silva
Open Source Developer
Linux Technology Centre, IBM Australia
mob: 0423 762 819



More information about the Skiboot mailing list