[PATCH 2/2] make IS_ERR_VALUE() complain about non-pointer-sized arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



IS_ERR_VALUE() needs a pointer sized argument, so warn when any int
sized arguments sneak in. When this happens a warning is generated:

warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Based on Kernel commit aa00edc1287a ("make IS_ERR_VALUE() complain about non-pointer-sized arguments")

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 include/linux/err.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/err.h b/include/linux/err.h
index 69efc7c4ac..db7ad6cc5b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -19,7 +19,7 @@
 
 #ifndef __ASSEMBLY__
 
-#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
+#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
 
 static inline void *ERR_PTR(long error)
 {
-- 
2.30.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux