[LTP] [PATCH] mmap22: Bound child memory allocation to avoid OOM

Cyril Hrubis chrubis@suse.cz
Wed Nov 4 17:32:07 CET 2026


Hi!
> Assisted-by: Gemini CLI
> Signed-off-by: Attila Fazekas <afazekas@redhat.com>
> ---
>  testcases/kernel/syscalls/mmap/mmap22.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/mmap/mmap22.c b/testcases/kernel/syscalls/mmap/mmap22.c
> index 0b95c578f..16fcb6dd8 100644
> --- a/testcases/kernel/syscalls/mmap/mmap22.c
> +++ b/testcases/kernel/syscalls/mmap/mmap22.c
> @@ -26,6 +26,7 @@
>  
>  #define MEM_LIMIT (256 * TST_MB)
>  #define ALLOC_SIZE (128 * TST_MB)
> +#define CHILD_ALLOC_MAX (ALLOC_SIZE + 32 * TST_MB)
                             ^
			     Wouldn't this be better:
			     (MEM_LIMIT - ALLOC_SIZE + 32*TST_MB)

That way this would stil work if we change either MEM_LIMIT or
ALLOC_SIZE.

Otherwise the change looks good.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list