linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [patch] mtd: maps: sa1100-flash: potential NULL dereference
@ 2016-07-15 11:06 Dan Carpenter
  2016-07-16  0:32 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2016-07-15 11:06 UTC (permalink / raw)
  To: David Woodhouse, Frans Klaver; +Cc: Brian Norris, linux-mtd, kernel-janitors

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>

diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 142fc3d..784c6e1 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -230,8 +230,10 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
 
 		info->mtd = mtd_concat_create(cdev, info->num_subdev,
 					      plat->name);
-		if (info->mtd == NULL)
+		if (info->mtd == NULL) {
 			ret = -ENXIO;
+			goto err;
+		}
 	}
 	info->mtd->dev.parent = &pdev->dev;
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-17  3:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 11:06 [patch] mtd: maps: sa1100-flash: potential NULL dereference Dan Carpenter
2016-07-16  0:32 ` Brian Norris
2016-07-16  0:48   ` Greg Kroah-Hartman
2016-07-16  1:46     ` Brian Norris
2016-07-16  9:00   ` Dan Carpenter
2016-07-17  3:54     ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).