mtd: physmap_of: fix null pointer deference when kzalloc returns null
authorColin Ian King <colin.king@canonical.com>
Fri, 17 Jul 2015 10:37:52 +0000 (11:37 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 19 Aug 2015 00:57:19 +0000 (17:57 -0700)
commit7e0c19c9608483808e6b5c294e357fa456f058e1
treebef1c0a26bcb32b9dd18f2432d8f07e53ec4776b
parent11c7e0e2f91fdfdf9f7b4d107bc93d6c298c95fe
mtd: physmap_of: fix null pointer deference when kzalloc returns null

static analysis by smatch caught the following error:

drivers/mtd/maps/physmap_of.c:135 of_get_probes()
   error: potential null dereference 'res'.  (kzalloc returns null)

Check for failed kzalloc and return -ENOMEM in of_flash_probe if
this occurs.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/maps/physmap_of.c