From 2d2e4715a65ca7e81b292d01ae009a03ccedb9b5 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Wed, 9 Sep 2015 15:36:17 -0700 Subject: kstrto*: accept "-0" for signed conversion strtol(3) et al accept "-0", so should we. Signed-off-by: Alexey Dobriyan Cc: David Howells Cc: Jan Kara Cc: Joel Becker Cc: Mark Fasheh Cc: Theodore Ts'o Cc: Rasmus Villemoes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/kstrtox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kstrtox.c') diff --git a/lib/kstrtox.c b/lib/kstrtox.c index ec8da78df9be..94be244e8441 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c @@ -152,7 +152,7 @@ int kstrtoll(const char *s, unsigned int base, long long *res) rv = _kstrtoull(s + 1, base, &tmp); if (rv < 0) return rv; - if ((long long)(-tmp) >= 0) + if ((long long)-tmp > 0) return -ERANGE; *res = -tmp; } else { -- cgit v1.2.3