X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=lib%2Fkstrtox.c;h=b8e2080c1a47a24a14c9618cd0dac5e4da0c0c67;hb=6b25e21fa6f26d0f0d45f161d169029411c84286;hp=d8a5cf66c316fe21eaecee8d973deac1eb3bd5d7;hpb=005e8dad01d2a7b98948927d7e0c4c7c61ec2d69;p=cascardo%2Flinux.git diff --git a/lib/kstrtox.c b/lib/kstrtox.c index d8a5cf66c316..b8e2080c1a47 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c @@ -48,11 +48,9 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long { unsigned long long res; unsigned int rv; - int overflow; res = 0; rv = 0; - overflow = 0; while (*s) { unsigned int val; @@ -71,15 +69,13 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long */ if (unlikely(res & (~0ull << 60))) { if (res > div_u64(ULLONG_MAX - val, base)) - overflow = 1; + rv |= KSTRTOX_OVERFLOW; } res = res * base + val; rv++; s++; } *p = res; - if (overflow) - rv |= KSTRTOX_OVERFLOW; return rv; }