mtd: maps: sa1100-flash: potential NULL dereference

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Aug 1 18:59:09 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=dc01a28d80a42cef08c94dfc595565aaebe46d15
Commit:     dc01a28d80a42cef08c94dfc595565aaebe46d15
Parent:     161aaab8a067a96b686e2429a72bfd92f6aaf363
Author:     Dan Carpenter <dan.carpenter at oracle.com>
AuthorDate: Fri Jul 15 14:06:30 2016 +0300
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Jul 15 18:40:25 2016 -0700

    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 at oracle.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/maps/sa1100-flash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
 



More information about the linux-mtd-cvs mailing list