Re: [PATCH] selftests/mm: cleanup -Wformat issues in hugetlb-mmap
From: Sarthak Sharma
Date: Mon Sep 28 2026 - 01:01:28 EST
On 9/27/26 9:54 PM, Carlos Llamas wrote:
> Commit ae571cd6015c ("selftests/mm: hugetlb-mmap: add setup of HugeTLB
> pages") and commit 9c5a65f374f8 ("selftests/mm: merge map_hugetlb into
> hugepage-mmap") added logs of 'hugepage_size' which has a size_t type.
> However, the incorrect format specifier '%lu' was used which triggers
> -Wformat warnings when building for 32-bit:
>
> hugetlb-mmap.c:125:55: warning: format specifies type 'unsigned long'
> but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
> 125 | ksft_print_msg("Default size hugepages (%lu kB)\n", hugepage_size >> 10);
> | ~~~ ^~~~~~~~~~~~~~~~~~~
> | %zu
>
> hugetlb-mmap.c:134:47: warning: format specifies type 'unsigned long'
> but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
> 134 | ksft_exit_skip("Not enough %lu Kb pages\n", hugepage_size >> 10);
> | ~~~ ^~~~~~~~~~~~~~~~~~~
> | %zu
>
> Fix this by switching to the expected '%zu' format specifier.
>
> Cc: Mike Rapoport <rppt@xxxxxxxxxx>
> Signed-off-by: Carlos Llamas <cmllamas@xxxxxxxxxx>
LGTM, so:
Reviewed-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>