[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200909032312.10418.eike-kernel@sf-tec.de>
Date: Thu, 3 Sep 2009 23:12:01 +0200
From: Rolf Eike Beer <eike-kernel@...tec.de>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] Make sure the value in abs() does not get truncated if it is greater than 2^32
I was just digging a bit around in linux/kernel.h and stumbled over the abs()
makro. For me it looks as it would return wrong results on 64 bit platforms
if the input value is greater than 2^32.
Signed-off-by: Rolf Eike Beer <eike-kernel@...tec.de>
---
include/linux/kernel.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d6320a3..1e6eb66 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -145,7 +145,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; \
})
--
1.6.0.2
Download attachment "signature.asc " of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists