提交 774b1382 编写于 作者: R Roel Kluin 提交者: Artem Bityutskiy

UBI: fix check on unsigned long

result is unsigned, the wrong check was used.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 2eadaad6
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册