From: Roel Kluin Date: Fri, 16 Oct 2009 12:00:17 +0000 (+0200) Subject: UBI: fix check on unsigned long X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=774b1382106529ad963d011931c1b911db05be68;p=deliverable%2Flinux.git UBI: fix check on unsigned long result is unsigned, the wrong check was used. Signed-off-by: Roel Kluin Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index e1f7d0a78b9d..14cec04c34f9 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -42,6 +42,7 @@ #include #include #include +#include #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;