Skip to content

Commit e8b7d11

Browse files
elfringmiquelraynal
authored andcommitted
mtd: ssfdc: One function call less in ssfdcr_add_mtd() after error detection
The kfree() function was called in one case by the ssfdcr_add_mtd() function during error handling even if the passed data structure member contained a null pointer. This issue was detected by using the Coccinelle software. Thus use another label. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 8d55a90 commit e8b7d11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/mtd/ssfdc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
332332
kmalloc_array(ssfdc->map_len,
333333
sizeof(ssfdc->logic_block_map[0]), GFP_KERNEL);
334334
if (!ssfdc->logic_block_map)
335-
goto out_err;
335+
goto out_free_ssfdc;
336336
memset(ssfdc->logic_block_map, 0xff, sizeof(ssfdc->logic_block_map[0]) *
337337
ssfdc->map_len);
338338

@@ -350,6 +350,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
350350

351351
out_err:
352352
kfree(ssfdc->logic_block_map);
353+
out_free_ssfdc:
353354
kfree(ssfdc);
354355
}
355356

0 commit comments

Comments
 (0)