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

Ricardo B. Marlière rbm@suse.com
Thu Jul 31 16:44:56 CEST 2025


On Thu Jul 31, 2025 at 11:35 AM -03, Petr Vorel wrote:
> 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?).

Random, yes!

>
> 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;

Thank you,

Reviewed-by: Ricardo B. Marlière <rbm@suse.com>

>  static size_t page_sz;
>  static unsigned long vma_size;
>  static int map_count;



More information about the ltp mailing list