[PATCH] selftests/io_uring: cast optval through uintptr_t in mini_liburing.h

From: Sasha Levin

Date: Tue Nov 03 2026 - 13:41:44 EST


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.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
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;
sqe->optlen = optlen;
}

--
2.53.0