public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] add a check to prevent the incrementing of possible NULL value for "region" in onenand_base.c
@ 2011-05-04 11:26 john.maxin
  2011-05-05 18:51 ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: john.maxin @ 2011-05-04 11:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: kyungmin.park, dwmw2


 Hi,

Coverity has reported that inside the function "onenand_block_by_block_erase()" in onenand_base.c, we should add checks to prevent the incrementing of possible NULL value for "region"
Thanks a lot to Adrian Hunter for suggesting a better solution.

Signed-off-by: Maxin B. John <john.maxin@nokia.com>
---
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 56a8b20..fd659f8 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2424,7 +2424,7 @@ static int onenand_block_by_block_erase(struct mtd_info *mtd,
                len -= block_size;
                addr += block_size;

-               if (addr == region_end) {
+               if (region && addr == region_end) {
                        if (!len)
                                break;
                        region++;

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

end of thread, other threads:[~2011-05-06  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 11:26 [PATCH] add a check to prevent the incrementing of possible NULL value for "region" in onenand_base.c john.maxin
2011-05-05 18:51 ` Artem Bityutskiy
2011-05-06  8:33   ` john.maxin

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