mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
mtd: Add check for devm_kcalloc()
Add a check for devm_kcalloc() to ensure successful allocation.
Fixes: 78c08247b9
("mtd: Support kmsg dumper based on pstore/blk")
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
1b61a59876
commit
2aee30bb10
1 changed files with 3 additions and 0 deletions
|
@ -423,6 +423,9 @@ static void mtdpstore_notify_add(struct mtd_info *mtd)
|
|||
longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize));
|
||||
cxt->badmap = devm_kcalloc(&mtd->dev, longcnt, sizeof(long), GFP_KERNEL);
|
||||
|
||||
if (!cxt->rmmap || !cxt->usedmap || !cxt->badmap)
|
||||
return;
|
||||
|
||||
/* just support dmesg right now */
|
||||
cxt->dev.flags = PSTORE_FLAGS_DMESG;
|
||||
cxt->dev.zone.read = mtdpstore_read;
|
||||
|
|
Loading…
Add table
Reference in a new issue