Commit 774b1382 authored by Roel Kluin's avatar Roel Kluin Committed by Artem Bityutskiy

UBI: fix check on unsigned long

result is unsigned, the wrong check was used.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 2eadaad6
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/kernel.h>
#include "ubi.h" #include "ubi.h"
/* Maximum length of the 'mtd=' parameter */ /* Maximum length of the 'mtd=' parameter */
...@@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str) ...@@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str)
unsigned long result; unsigned long result;
result = simple_strtoul(str, &endp, 0); 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", printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
str); str);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment