public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH Resend] mtd: s3c2410: Fix potential NULL pointer dereference error
@ 2012-11-16 10:38 Sachin Kamat
  2012-11-18 10:45 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Sachin Kamat @ 2012-11-16 10:38 UTC (permalink / raw)
  To: linux-mtd; +Cc: sachin.kamat, patches, dwmw2, dedekind1

'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 |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 295e4be..bbc49c4 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;
 }
 
 /**
-- 
1.7.4.1

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

* Re: [PATCH Resend] mtd: s3c2410: Fix potential NULL pointer dereference error
  2012-11-16 10:38 [PATCH Resend] mtd: s3c2410: Fix potential NULL pointer dereference error Sachin Kamat
@ 2012-11-18 10:45 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2012-11-18 10:45 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: dwmw2, linux-mtd, patches

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

On Fri, 2012-11-16 at 16:08 +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>

Pushed to l2-mtd.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-11-18 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 10:38 [PATCH Resend] mtd: s3c2410: Fix potential NULL pointer dereference error Sachin Kamat
2012-11-18 10:45 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox