mtd: onenand: add missing check
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue May 24 21:59:05 EDT 2011
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=eff3bba61fc19a64a1ca56343e38b6506bef9dea
Commit: eff3bba61fc19a64a1ca56343e38b6506bef9dea
Parent: 26d9be11485ea8c1102c3e8eaa7667412eef4950
Author: john.maxin at nokia.com <john.maxin at nokia.com>
AuthorDate: Fri May 6 09:17:21 2011 +0000
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed May 25 02:01:38 2011 +0100
mtd: onenand: add missing check
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 at nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/onenand/onenand_base.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index d27f93b..289ee3b 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2453,7 +2453,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++;
More information about the linux-mtd-cvs
mailing list