[LTP] [PATCH 1/1] munmap04: Fix 'base' overflow

Petr Vorel pvorel@suse.cz
Thu Jul 31 16:35:50 CEST 2025


Lower down a base to fix overflow on 32 bit:

munmap04.c:18:25: warning: conversion from ‘long long unsigned int’ to
‘uintptr_t’ {aka ‘unsigned int’} changes value from ‘4294967296’ to ‘0’ [-Woverflow]
   18 | static uintptr_t base = 0x100000000UL;
      |                         ^~~~~~~~~~~~~

Fixes: 1e2c98e3af ("Add munmap04 to check ENOMEM")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

I'm not sure how this influences recent fixes. And how the base address
was actually chosen (just random memory location?).

Kind regards,
Petr

 testcases/kernel/syscalls/munmap/munmap04.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/munmap/munmap04.c b/testcases/kernel/syscalls/munmap/munmap04.c
index 987a7c7e7a..e1b67aeee3 100644
--- a/testcases/kernel/syscalls/munmap/munmap04.c
+++ b/testcases/kernel/syscalls/munmap/munmap04.c
@@ -15,7 +15,7 @@
 #define MEMSIZE 3
 #define MAP_MAX_COUNT 65530
 
-static uintptr_t base = 0x100000000UL;
+static uintptr_t base = 0x10000000UL;
 static size_t page_sz;
 static unsigned long vma_size;
 static int map_count;
-- 
2.50.1



More information about the ltp mailing list