public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Kyungmin Park <kyungmin.park@samsung.com>
To: 'Roel Kluin' <roel.kluin@gmail.com>,
	linux-mtd@lists.infradead.org,
	'Andrew Morton' <akpm@linux-foundation.org>,
	'LKML' <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] OneNAND: Fix test of unsigned in onenand_otp_walk()
Date: Wed, 16 Dec 2009 10:20:30 +0900	[thread overview]
Message-ID: <003301ca7ded$f50a8930$df1f9b90$%park@samsung.com> (raw)
In-Reply-To: <4B282BBD.4050106@gmail.com>

Acked-by: Kyungmin Park <kyungmin.park@samsung.com>

> -----Original Message-----
> From: Roel Kluin [mailto:roel.kluin@gmail.com]
> Sent: Wednesday, December 16, 2009 9:37 AM
> To: Kyungmin Park; linux-mtd@lists.infradead.org; Andrew Morton; LKML
> Subject: [PATCH] OneNAND: Fix test of unsigned in onenand_otp_walk()
> 
> mtd->writesize and len are unsigned so the test does not work.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> you can test this with:
> 
> #include <stdio.h>
> 
> int main()
> {
>         int c = 1, d = 1;
>         unsigned a = 30;
>         unsigned b = 10;
> 
>         if ((b * c) - (d + a) < 0)
>                 printf("good\n");
>         else
>                 printf("bad\n");
>         return 0;
> }
> 
> 
> diff --git a/drivers/mtd/onenand/onenand_base.c
> b/drivers/mtd/onenand/onenand_base.c
> index ff66e43..cbe2711 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -2725,7 +2725,7 @@ static int onenand_otp_walk(struct mtd_info *mtd,
> loff_t from, size_t len,
>  	}
> 
>  	/* Check User/Factory boundary */
> -	if (((mtd->writesize * otp_pages) - (from + len)) < 0)
> +	if (mtd->writesize * otp_pages < from + len)
>  		return 0;
> 
>  	onenand_get_device(mtd, FL_OTPING);

      reply	other threads:[~2009-12-16  1:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16  0:37 [PATCH] OneNAND: Fix test of unsigned in onenand_otp_walk() Roel Kluin
2009-12-16  1:20 ` Kyungmin Park [this message]

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='003301ca7ded$f50a8930$df1f9b90$%park@samsung.com' \
    --to=kyungmin.park@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=roel.kluin@gmail.com \
    /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