提交 99b1d188 编写于 作者: H Hauke Mehrtens 提交者: Brian Norris

mtd: bcm47xxpart: handle malloc failures

Handle return NULL in malloc.
Signed-off-by: NHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
上级 7e3019e3
...@@ -71,7 +71,14 @@ static int bcm47xxpart_parse(struct mtd_info *master, ...@@ -71,7 +71,14 @@ static int bcm47xxpart_parse(struct mtd_info *master,
/* Alloc */ /* Alloc */
parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
GFP_KERNEL); GFP_KERNEL);
if (!parts)
return -ENOMEM;
buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL); buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL);
if (!buf) {
kfree(parts);
return -ENOMEM;
}
/* Parse block by block looking for magics */ /* Parse block by block looking for magics */
for (offset = 0; offset <= master->size - blocksize; for (offset = 0; offset <= master->size - blocksize;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册