Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: maps: sa1100-flash: potential NULL dereference

We check for NULL but then dereference "info->mtd" on the next line.

Fixes: 72169755cf36 ('mtd: maps: sa1100-flash: show parent device in sysfs')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Dan Carpenter and committed by
Brian Norris
dc01a28d 161aaab8

+3 -1
+3 -1
drivers/mtd/maps/sa1100-flash.c
··· 230 230 231 231 info->mtd = mtd_concat_create(cdev, info->num_subdev, 232 232 plat->name); 233 - if (info->mtd == NULL) 233 + if (info->mtd == NULL) { 234 234 ret = -ENXIO; 235 + goto err; 236 + } 235 237 } 236 238 info->mtd->dev.parent = &pdev->dev; 237 239