From: Artem Bityutskiy <dedekind@infradead.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] UBI: Fix check on unsigned in ytes_str_to_int()
Date: Tue, 20 Oct 2009 10:20:17 +0300 [thread overview]
Message-ID: <1256023217.29856.122.camel@localhost> (raw)
In-Reply-To: <4AD86051.2040302@gmail.com>
On Fri, 2009-10-16 at 14:00 +0200, Roel Kluin wrote:
> result is unsigned, the wrong check was used.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index e1f7d0a..14cec04 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -42,6 +42,7 @@
> #include <linux/log2.h>
> #include <linux/kthread.h>
> #include <linux/reboot.h>
> +#include <linux/kernel.h>
> #include "ubi.h"
>
> /* Maximum length of the 'mtd=' parameter */
> @@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str)
> unsigned long result;
>
> result = simple_strtoul(str, &endp, 0);
> - if (str == endp || result < 0) {
> + if (str == endp || result >= INT_MAX) {
> printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
> str);
> return -EINVAL;
Pushed to ubi-2.6 tree, will send to Linus soon, thanks.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
prev parent reply other threads:[~2009-10-20 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 12:00 [PATCH] UBI: Fix check on unsigned in ytes_str_to_int() Roel Kluin
2009-10-20 7:20 ` Artem Bityutskiy [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=1256023217.29856.122.camel@localhost \
--to=dedekind@infradead.org \
--cc=akpm@linux-foundation.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