* [PATCH v2] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h
@ 2026-11-04 14:46 Sasha Levin
2026-11-04 15:07 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-11-04 14:46 UTC (permalink / raw)
To: Jens Axboe
Cc: Pavel Begunkov, Breno Leitao, io-uring, Shuah Khan,
linux-kselftest, linux-kernel
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, and include <stdint.h> for it.
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
v2: include <stdint.h> for uintptr_t (Breno).
v1: https://lore.kernel.org/r/20261103163926.641431-1-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.
tools/include/io_uring/mini_liburing.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/include/io_uring/mini_liburing.h b/tools/include/io_uring/mini_liburing.h
index 44be4446feda5..6afe7efb44978 100644
--- a/tools/include/io_uring/mini_liburing.h
+++ b/tools/include/io_uring/mini_liburing.h
@@ -3,6 +3,7 @@
#include <linux/io_uring.h>
#include <sys/mman.h>
#include <sys/syscall.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -269,7 +270,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;
sqe->optlen = optlen;
}
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h
2026-11-04 14:46 [PATCH v2] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h Sasha Levin
@ 2026-11-04 15:07 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2026-11-04 15:07 UTC (permalink / raw)
To: Sasha Levin
Cc: Pavel Begunkov, Breno Leitao, io-uring, Shuah Khan,
linux-kselftest, linux-kernel
On Wed, 04 Nov 2026 09:46:23 -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, and include <stdint.h> for it.
>
> [...]
Applied, thanks!
[1/1] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h
commit: 699e7ba5915c8b2c76e257e157464f2bfe7ab8bb
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-04 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 14:46 [PATCH v2] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h Sasha Levin
2026-11-04 15:07 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®