projects
/
GitHub
/
MotorolaMobilityLLC
/
kernel-slsi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7e3019e
)
mtd: bcm47xxpart: handle malloc failures
author
Hauke Mehrtens
<hauke@hauke-m.de>
Sun, 13 Oct 2013 20:53:49 +0000
(22:53 +0200)
committer
Brian Norris
<computersforpeace@gmail.com>
Thu, 7 Nov 2013 07:32:57 +0000
(23:32 -0800)
Handle return NULL in malloc.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/bcm47xxpart.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/mtd/bcm47xxpart.c
b/drivers/mtd/bcm47xxpart.c
index 9279a9174f84ad9cd3a2ae2c7117c29cc8134e9e..6d427468c4cdba0ef51334a0043080a08608c2a9 100644
(file)
--- a/
drivers/mtd/bcm47xxpart.c
+++ b/
drivers/mtd/bcm47xxpart.c
@@
-71,7
+71,14
@@
static int bcm47xxpart_parse(struct mtd_info *master,
/* Alloc */
parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
GFP_KERNEL);
+ if (!parts)
+ return -ENOMEM;
+
buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL);
+ if (!buf) {
+ kfree(parts);
+ return -ENOMEM;
+ }
/* Parse block by block looking for magics */
for (offset = 0; offset <= master->size - blocksize;