public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: john.maxin@nokia.com
Cc: dwmw2@infradead.org, kyungmin.park@samsung.com,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH] add a check to prevent the incrementing of possible NULL value for "region" in onenand_base.c
Date: Thu, 05 May 2011 21:51:39 +0300	[thread overview]
Message-ID: <1304621499.7222.57.camel@localhost> (raw)
In-Reply-To: <77DFD0EF40BC5042BB7221A1EFFF75709578@008-AM1MPN1-021.mgdnok.nokia.com>

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 (Артём Битюцкий)

  reply	other threads:[~2011-05-05 18:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-05-06  8:33   ` john.maxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304621499.7222.57.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=john.maxin@nokia.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox