Message ID | CALAqxLXYCvFDPd2jh+OhoRr0ncWhbHtDqRv5ev+NCuhu8_8n8w@mail.gmail.com |
---|---|
State | New |
Headers | show |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 5582410..753be99 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -8,6 +8,7 @@ #include <linux/types.h> #include <linux/compiler.h> #include <linux/bitops.h> +#include <linux/bug.h> #include <linux/log2.h> #include <linux/typecheck.h> #include <linux/printk.h> @@ -208,6 +209,9 @@ extern int _cond_resched(void); */ #define abs(x) ({ \ long ret; \ + BUILD_BUG_ON_MSG( \ + sizeof(typeof(x)) > sizeof(long), \ + "abs() should not be used for 64-bit types - use abs64()");\ if (sizeof(x) == sizeof(long)) { \ long __x = (x); \ ret = (__x < 0) ? -__x : __x; \