[PATCH 2/2] make IS_ERR_VALUE() complain about non-pointer-sized arguments
Sascha Hauer
s.hauer at pengutronix.de
Mon Nov 7 02:07:27 PST 2022
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 at pengutronix.de>
---
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
More information about the barebox
mailing list