projects
/
platform
/
kernel
/
linux-3.10.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d7d7561
)
Make sure the value in abs() does not get truncated if it is greater than 2^32
author
Rolf Eike Beer
<eike-kernel@sf-tec.de>
Tue, 22 Sep 2009 23:44:03 +0000
(16:44 -0700)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:30 +0000
(07:39 -0700)
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 <eike-kernel@sf-tec.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/kernel.h
patch
|
blob
|
history
diff --git
a/include/linux/kernel.h
b/include/linux/kernel.h
index
63dcaec
..
d3cd23f
100644
(file)
--- 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; \
})