linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] mtd: onenand: onenand_base: check for region != NULL
@ 2011-05-06  9:17 john.maxin
  2011-05-06 19:04 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: john.maxin @ 2011-05-06  9:17 UTC (permalink / raw)
  To: linux-mtd; +Cc: kyungmin.park, dwmw2, dedekind1


Coverity has reported that inside the function "onenand_block_by_block_erase()" 
in onenand_base.c, we should add a check to prevent the incrementing of 
possible NULL value for "region"

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] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06  9:17 [PATCH RESEND] mtd: onenand: onenand_base: check for region != NULL john.maxin
2011-05-06 19:04 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).