diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-10-13 16:53:49 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-11-07 02:32:57 -0500 |
commit | 99b1d1887fee36ef9ff5d2ee24f0cf3e8c172104 (patch) | |
tree | 57b873a3b0087676ceb10d23a7b15327f146efc8 /drivers/mtd | |
parent | 7e3019e364f1b6b9ce123e747addcdc96e8d74ae (diff) |
mtd: bcm47xxpart: handle malloc failures
Handle return NULL in malloc.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/bcm47xxpart.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index 9279a9174f84..6d427468c4cd 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c | |||
@@ -71,7 +71,14 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
71 | /* Alloc */ | 71 | /* Alloc */ |
72 | parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, | 72 | parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, |
73 | GFP_KERNEL); | 73 | GFP_KERNEL); |
74 | if (!parts) | ||
75 | return -ENOMEM; | ||
76 | |||
74 | buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL); | 77 | buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL); |
78 | if (!buf) { | ||
79 | kfree(parts); | ||
80 | return -ENOMEM; | ||
81 | } | ||
75 | 82 | ||
76 | /* Parse block by block looking for magics */ | 83 | /* Parse block by block looking for magics */ |
77 | for (offset = 0; offset <= master->size - blocksize; | 84 | for (offset = 0; offset <= master->size - blocksize; |