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: v3.0~7714 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a49c59c042c63b432307c1bbf7dac5a104c786e6;p=platform%2Fkernel%2Flinux-amlogic.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 63dcaec..d3cd23f 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; \ })