From d6767a5ffa139abb70af8dce7baae7be9bc89817 Mon Sep 17 00:00:00 2001 From: Cyril Bur Date: Mon, 11 Jul 2016 11:35:09 +1000 Subject: mambo: Add NULL checks and error messages 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 Reviewed-by: Andrew Donnellan Signed-off-by: Stewart Smith --- platforms/mambo/mambo.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'platforms') 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; -- cgit v1.1