From: Andrew Morton Date: Thu, 13 Sep 2012 01:01:11 +0000 (+1000) Subject: lib-parserc-avoid-overflow-in-match_number-fix X-Git-Tag: next-20120918~1^2~86 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7cfa20c51ab364005fb95cca1ed5e37b0eb9ff61;p=karo-tx-linux.git lib-parserc-avoid-overflow-in-match_number-fix coding-style tweaks Cc: Alex Elder Signed-off-by: Andrew Morton --- diff --git a/lib/parser.c b/lib/parser.c index 2499cb87774c..52cfa69f73df 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -142,7 +142,7 @@ static int match_number(substring_t *s, int *result, int base) val = simple_strtol(buf, &endp, base); if (endp == buf) ret = -EINVAL; - else if (val < (long) INT_MIN || val > (long) INT_MAX) + else if (val < (long)INT_MIN || val > (long)INT_MAX) ret = -ERANGE; else *result = (int) val;