Skip to content

Commit

Permalink
UBI: fix check on unsigned long
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Artem Bityutskiy committed Oct 20, 2009
1 parent 2eadaad commit 774b138
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 774b138

Please sign in to comment.