[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202506271342.8913E9B@keescook>
Date: Fri, 27 Jun 2025 13:44:08 -0700
From: Kees Cook <kees@...nel.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Shuah Khan <shuah@...nel.org>, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH] selftests: harness: Rework is_signed_type() to avoid
collision with overflow.h
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
Powered by blists - more mailing lists