All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Sasha Levin <sashal@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	 io-uring@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h
Date: Wed, 4 Nov 2026 02:15:49 -0800	[thread overview]
Message-ID: <ausFj54fk-_oP5i5@gmail.com> (raw)
In-Reply-To: <20261103163926.641431-1-sashal@kernel.org>

On Tue, Nov 03, 2026 at 11:39:26AM -0500, Sasha Levin wrote:
> io_uring_prep_cmd() puts the optval pointer into the 64-bit optval field
> of the SQE with a plain cast, which warns on 32-bit architectures:
> 
>   mini_liburing.h:272:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> Cast through uintptr_t.

Thanks for the fix.
I see the same warning with gcc -m32, and it is gone with this patch.

> Signed-off-by: Sasha Levin <sashal@kernel.org>

Reviewed-by: Breno Leitao <leitao@debian.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.
> 
>  tools/include/io_uring/mini_liburing.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/include/io_uring/mini_liburing.h b/tools/include/io_uring/mini_liburing.h
> index 44be4446feda5..1f5b0cfc1e5b6 100644
> --- a/tools/include/io_uring/mini_liburing.h
> +++ b/tools/include/io_uring/mini_liburing.h
> @@ -269,7 +269,7 @@ static inline void io_uring_prep_cmd(struct io_uring_sqe *sqe, int op,
>  
>  	sqe->level = level;
>  	sqe->optname = optname;
> -	sqe->optval = (unsigned long long)optval;
> +	sqe->optval = (unsigned long long)(uintptr_t)optval;

mini_liburing.h doesn't include <stdint.h>, so uintptr_t only resolves
because both users include it first: io_uring_zerocopy_tx.c directly,
and prog_tests/sockopt.c through bpf/bpf.h and bpf/libbpf.h from
test_progs.h.

Since this adds the first uintptr_t in the file, should it
also add #include <stdint.h> next to the other includes?

      reply	other threads:[~2026-11-04 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:39 [PATCH] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h Sasha Levin
2026-11-04 10:15 ` Breno Leitao [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=ausFj54fk-_oP5i5@gmail.com \
    --to=leitao@debian.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.