* [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* Re: [PATCH] add a check to prevent the incrementing of possible NULL value for "region" in onenand_base.c
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
0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2011-05-05 18:51 UTC (permalink / raw)
To: john.maxin; +Cc: dwmw2, kyungmin.park, linux-mtd
On Wed, 2011-05-04 at 11:26 +0000, john.maxin@nokia.com wrote:
> 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>
The commit message should not contain that long lines - use max 80
lines. The commit message should not start with "Hi". The subject should
be short and more high level - the details go to the commit message.
Could you please improve this and re-submit?
> ---
> 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++;
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH] add a check to prevent the incrementing of possible NULL value for "region" in onenand_base.c
2011-05-05 18:51 ` Artem Bityutskiy
@ 2011-05-06 8:33 ` john.maxin
0 siblings, 0 replies; 3+ messages in thread
From: john.maxin @ 2011-05-06 8:33 UTC (permalink / raw)
To: dedekind1; +Cc: dwmw2, kyungmin.park, linux-mtd
Hi Artem,
>The commit message should not contain that long lines - use max 80
>lines. The commit message should not start with "Hi". The subject should
>be short and more high level - the details go to the commit message.
>Could you please improve this and re-submit?
Oops.. I am sorry. Thanks a lot for pointing out my mistakes.
I will make the modifications as per your instruction and will resubmit the patch.
Thanks and Regards,
Maxin
_______________________________________
From: ext Artem Bityutskiy [dedekind1@gmail.com]
Sent: Thursday, May 05, 2011 8:51 PM
To: Maxin John (Nokia-SD/Helsinki)
Cc: linux-mtd@lists.infradead.org; kyungmin.park@samsung.com; dwmw2@infradead.org
Subject: Re: [PATCH] add a check to prevent the incrementing of possible NULL value for "region" in onenand_base.c
On Wed, 2011-05-04 at 11:26 +0000, john.maxin@nokia.com wrote:
> 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++;
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [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