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

Stewart Smith stewart at linux.vnet.ibm.com
Mon Jul 11 12:05:41 AEST 2016


Cyril Bur <cyril.bur at au1.ibm.com> writes:
> 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);
> +			prerror("mambo: Failed to start bogus disk, ENOMEM\n");
> +			return;
> +		}
>  
>  		bl->read = &bogus_disk_read;
>  		bl->write = &bogus_disk_write;

Thanks, merged to master as of d6767a5.

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list