]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
UBI: fix check on unsigned long
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 16 Oct 2009 12:00:17 +0000 (14:00 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 20 Oct 2009 07:13:49 +0000 (10:13 +0300)
result is unsigned, the wrong check was used.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/build.c

index e1f7d0a78b9d58e28a2b6c1fdad43423cddd3956..14cec04c34f90c8adec61770e6607faa5f8540ab 100644 (file)
@@ -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;