From: Kees Cook <kees@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH] selftests: harness: Rework is_signed_type() to avoid collision with overflow.h
Date: Fri, 27 Jun 2025 13:44:08 -0700 [thread overview]
Message-ID: <202506271342.8913E9B@keescook> (raw)
In-Reply-To: <20250624231930.583689-1-seanjc@google.com>
On Tue, Jun 24, 2025 at 04:19:30PM -0700, Sean Christopherson wrote:
> Rename is_signed_type() to is_signed_var() to avoid colliding with a macro
> of the same name defined by linux/overflow.h. Note, overflow.h's version
> takes a type as the input, whereas the harness's version takes a variable!
Can we just update compiler.h to use typeof() and drop duplicates?
(typeof() a type is a pass-thru). Totally untested:
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 6f04a1d8c720..cb925b883806 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off)
* Whether 'type' is a signed type or an unsigned type. Supports scalar types,
* bool and also pointer types.
*/
-#define is_signed_type(type) (((type)(-1)) < (__force type)1)
+#define is_signed_type(type) (((typeof(type))(-1)) < (__force typeof(type))1)
#define is_unsigned_type(type) (!is_signed_type(type))
/*
--
Kees Cook
next prev parent reply other threads:[~2025-06-27 20:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 23:19 [PATCH] selftests: harness: Rework is_signed_type() to avoid collision with overflow.h Sean Christopherson
2025-06-26 15:06 ` Vincent Mailhol
2025-06-27 20:44 ` Kees Cook [this message]
2025-07-07 21:11 ` Sean Christopherson
2025-08-19 23:11 ` Sean Christopherson
2025-08-20 11:11 ` Mark Brown
2025-08-20 12:52 ` Sean Christopherson
2025-08-20 15:15 ` Sean Christopherson
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=202506271342.8913E9B@keescook \
--to=kees@kernel.org \
--cc=acme@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=seanjc@google.com \
--cc=shuah@kernel.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