From: Rolf Eike Beer Date: Tue, 22 Sep 2009 23:44:03 +0000 (-0700) Subject: Make sure the value in abs() does not get truncated if it is greater than 2^32 X-Git-Tag: v2.6.32-rc1~383 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a49c59c0;p=karo-tx-linux.git Make sure the value in abs() does not get truncated if it is greater than 2^32 abs() will truncate the input if is it outside the 2^32 range. Fix that by assuming `long' input. This might generate worse code in the common case. Signed-off-by: Rolf Eike Beer Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 63dcaece1ac5..d3cd23f30039 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -146,7 +146,7 @@ extern int _cond_resched(void); #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) #define abs(x) ({ \ - int __x = (x); \ + long __x = (x); \ (__x < 0) ? -__x : __x; \ })