On Tue, 3 Nov 2026 11:39:13 -0500
Sasha Levin [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Sasha Levin <sashal@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>
Cc: Beau Belgrave <redacted>, <redacted>, Shuah Khan <shuah@kernel.org>, <redacted>, <redacted>
Subject: [PATCH] selftests/user_events: cast pointers through uintptr_t
Date: Tue, 3 Nov 2026 11:39:13 -0500
The tests put pointers into the 64-bit fields of struct user_reg and
struct user_unreg with a plain (__u64) cast, which warns on 32-bit
architectures:
abi_test.c:182:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Cast through uintptr_t.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with 32-bit builds of the selftests (gcc 16 and clang 21 with
-m32, with and without -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64);
KernelCI's 32-bit arm builds show the same warnings. The changed files
build without them now, and the x86_64 builds don't change.
.../testing/selftests/user_events/abi_test.c | 10 +++---
.../testing/selftests/user_events/dyn_test.c | 6 ++--
.../selftests/user_events/ftrace_test.c | 32 +++++++++----------
.../testing/selftests/user_events/perf_test.c | 10 +++---
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/tools/testing/selftests/user_events/abi_test.c b/tools/testing/selftests/user_events/abi_test.c
index b71813eaf5c04..21e1e3cca1979 100644
--- a/tools/testing/selftests/user_events/abi_test.c
+++ b/tools/testing/selftests/user_events/abi_test.c
@@ -179,10 +179,10 @@ static int reg_enable_multi(void *enable, int size, int bit, int flags,
}
reg.size = sizeof(reg);
- reg.name_args = (__u64)full_args;
+ reg.name_args = (__u64)(uintptr_t)full_args;
I'm sure you can't need both casts.
David