From: Sachin Kamat Date: Fri, 16 Nov 2012 10:38:22 +0000 (+0530) Subject: mtd: s3c2410: Fix potential NULL pointer dereference error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ded4c55d108e0e4e4ba221b39a782e85d77a5ca0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mtd: s3c2410: Fix potential NULL pointer dereference error 'set' is tested for NULL. But subsequently accessed without the check. Thus making it conditional to avoid NULL pointer dereferencing. Signed-off-by: Sachin Kamat Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 295e4bedad96..bbc49c496076 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -730,11 +730,14 @@ static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info, struct s3c2410_nand_mtd *mtd, struct s3c2410_nand_set *set) { - if (set) + if (set) { mtd->mtd.name = set->name; - return mtd_device_parse_register(&mtd->mtd, NULL, NULL, + return mtd_device_parse_register(&mtd->mtd, NULL, NULL, set->partitions, set->nr_partitions); + } + + return -ENODEV; } /**