diff mbox

[2/2] mtd: s3c2410: Fix potential NULL pointer dereference error

Message ID 1352369324-25771-2-git-send-email-sachin.kamat@linaro.org
State Superseded
Headers show

Commit Message

Sachin Kamat Nov. 8, 2012, 10:08 a.m. UTC
'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 <sachin.kamat@linaro.org>
---
 drivers/mtd/nand/s3c2410.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Artem Bityutskiy Nov. 16, 2012, 8:49 a.m. UTC | #1
On Thu, 2012-11-08 at 15:38 +0530, Sachin Kamat wrote:
> '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 <sachin.kamat@linaro.org>

I did not take the previous patch which makes this patch not applicable.
Could you please re-send?
diff mbox

Patch

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index dfb8636..00fc12f 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -730,11 +730,11 @@  static void 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;
-
-	mtd_device_parse_register(&mtd->mtd, NULL, NULL,
-				  set->partitions, set->nr_partitions);
+		mtd_device_parse_register(&mtd->mtd, NULL, NULL,
+					  set->partitions, set->nr_partitions);
+	}
 }
 
 /**