public inbox for linux-mtd@lists.infradead.org
 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

* Re: [PATCH RESEND] mtd: onenand: onenand_base: check for region != NULL
  2011-05-06  9:17 [PATCH RESEND] mtd: onenand: onenand_base: check for region != NULL john.maxin
@ 2011-05-06 19:04 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2011-05-06 19:04 UTC (permalink / raw)
  To: john.maxin; +Cc: dwmw2, kyungmin.park, linux-mtd

On Fri, 2011-05-06 at 09:17 +0000, john.maxin@nokia.com wrote:
> 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>

This patch is not against the upstream kernel, I could not apply it. But
it is trivial enough and I could manually apply it. Pushed to
l2-mtd-2.6.git tree, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[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