summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-10-16 14:00:17 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-10-20 10:13:49 +0300
commit774b1382106529ad963d011931c1b911db05be68 (patch)
tree4d3a71c4b894a6b92c32391f5c8d79a2289dd2d0 /drivers/mtd
parent2eadaad67b2b6bd132eda105128d2d466298b8e3 (diff)
downloadlwn-774b1382106529ad963d011931c1b911db05be68.tar.gz
lwn-774b1382106529ad963d011931c1b911db05be68.zip
UBI: fix check on unsigned long
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/build.c3
1 files changed, 2 insertions, 1 deletions
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 <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;