From: David Laight <david.laight.linux@gmail.com>
To: Sasha Levin <sashal@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Beau Belgrave <beaub@linux.microsoft.com>,
linux-trace-kernel@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/user_events: cast pointers through uintptr_t
Date: Thu, 5 Nov 2026 11:03:33 +0000 [thread overview]
Message-ID: <20261105110333.0fa21741@pumpkin> (raw)
In-Reply-To: <20261103163913.640876-1-sashal@kernel.org>
On Tue, 3 Nov 2026 11:39:13 -0500
Sasha Levin <sashal@kernel.org> wrote:
> From: Sasha Levin <sashal@kernel.org>
> To: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Beau Belgrave <beaub@linux.microsoft.com>, linux-trace-kernel@vger.kernel.org, Shuah Khan <shuah@kernel.org>, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
> 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
next prev parent reply other threads:[~2026-11-05 11:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 16:39 [PATCH] selftests/user_events: cast pointers through uintptr_t Sasha Levin
2026-11-05 11:03 ` David Laight [this message]
2026-11-05 12:48 ` Sasha Levin
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=20261105110333.0fa21741@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=beaub@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sashal@kernel.org \
--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