[PATCH] selftests/proc: cast the PROCMAP_QUERY address through uintptr_t
From: Sasha Levin
Date: Tue Nov 03 2026 - 13:15:45 EST
proc-maps-race puts a pointer into the 64-bit query_addr field of struct
procmap_query with a plain cast, which warns on 32-bit architectures:
proc-maps-race.c:626:24: 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/testing/selftests/proc/proc-maps-race.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c
index bf4c5073f6fc8..c484a14eb6491 100644
--- a/tools/testing/selftests/proc/proc-maps-race.c
+++ b/tools/testing/selftests/proc/proc-maps-race.c
@@ -623,7 +623,7 @@ static bool query_addr_at(int maps_fd, void *addr,
memset(&q, 0, sizeof(q));
q.size = sizeof(q);
/* Find the VMA at the split address */
- q.query_addr = (unsigned long long)addr;
+ q.query_addr = (unsigned long long)(uintptr_t)addr;
q.query_flags = 0;
if (ioctl(maps_fd, PROCMAP_QUERY, &q))
return false;
--
2.53.0