Re: [PATCH] mm/show_mem: fix format string inconsistencies and type mismatches

Johannes Weiner <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
On Wed, Aug 05, 2026 at 10:15:55AM +0800, Ye Liu wrote:
> From: Ye Liu <[email protected]>
> 
> 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 <[email protected]>

Acked-by: Johannes Weiner <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.