Re: [PATCH] mm/show_mem: fix format string inconsistencies and type mismatches
From: Johannes Weiner
Date: Thu Aug 06 2026 - 15:52:23 EST
On Wed, Aug 05, 2026 at 10:15:55AM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@xxxxxxxxxx>
>
> Fix five format string issues in show_free_areas() and __show_mem():
>
> 1-2. reserved_highatomic and free_highatomic: %luKB -> %lukB
> The uppercase "KB" is inconsistent with all other fields in the
> same output block and with /proc/meminfo convention.
>
> 3. local_pcp: %ukB -> %lukB with explicit (unsigned long) cast
> per_cpu_pages.count is int, so K(count) yields int. Using %u
> was a signed/unsigned mismatch. Cast to unsigned long and use
> %lu for consistency with all other K() usages in the file.
>
> 4. total pagecache pages: %ld -> %lu
> global_node_page_state() returns unsigned long. Using %ld is a
> signedness mismatch caught by gcc -Wformat-signedness.
>
> 5. hwpoisoned pages: %lu -> %ld
> atomic_long_read() returns long (signed). Using %lu is a
> signedness mismatch caught by gcc -Wformat-signedness.
>
> Verified with: make KCFLAGS="-Wformat -Wformat-signedness" mm/show_mem.o
>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>