mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] make IS_ERR_VALUE() complain about non-pointer-sized arguments
Date: Mon,  7 Nov 2022 11:07:27 +0100	[thread overview]
Message-ID: <20221107100727.2510346-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20221107100727.2510346-1-s.hauer@pengutronix.de>

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@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




      reply	other threads:[~2022-11-07 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 10:07 [PATCH 1/2] nvmem: remove IS_ERR_VALUE abuses Sascha Hauer
2022-11-07 10:07 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221107100727.2510346-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox