From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Carlos Llamas <cmllamas@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Shuah Khan <shuah@kernel.org>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
"open list:MEMORY MANAGEMENT - MISC" <linux-mm@kvack.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH] selftests/mm: cleanup -Wformat issues in hugetlb-mmap
Date: Tue, 29 Sep 2026 10:11:57 +0100 [thread overview]
Message-ID: <aruA14n4S_gnCRd9@gremlin> (raw)
In-Reply-To: <20260927162419.820609-1-cmllamas@google.com>
On Sun, Sep 27, 2026 at 04:24:18PM +0000, 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@kernel.org>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>
> Note that I intentionally skipped the 'Fixes:' tag as I've been
> previously suggested _not_ to use it for kselftest patches. However, I
> can certainly add one if someone prefers it that way. Thanks!
>
> tools/testing/selftests/mm/hugetlb-mmap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/hugetlb-mmap.c b/tools/testing/selftests/mm/hugetlb-mmap.c
> index 0f2aad1b7dbd..2edbc992e6bc 100644
> --- a/tools/testing/selftests/mm/hugetlb-mmap.c
> +++ b/tools/testing/selftests/mm/hugetlb-mmap.c
> @@ -122,7 +122,7 @@ int main(int argc, char **argv)
> hugepage_size = default_huge_page_size();
> if (!hugepage_size)
> ksft_exit_skip("Could not detect default hugetlb page size.");
> - ksft_print_msg("Default size hugepages (%lu kB)\n", hugepage_size >> 10);
> + ksft_print_msg("Default size hugepages (%zu kB)\n", hugepage_size >> 10);
> }
>
> /* munmap will fail if the length is not page aligned */
> @@ -131,7 +131,7 @@ int main(int argc, char **argv)
>
> hugetlb_set_nr_pages(hugepage_size, nr);
> if (hugetlb_free_pages(hugepage_size) < nr)
> - ksft_exit_skip("Not enough %lu Kb pages\n", hugepage_size >> 10);
> + ksft_exit_skip("Not enough %zu Kb pages\n", hugepage_size >> 10);
>
> ksft_set_plan(2);
> ksft_print_msg("Mapping %lu Mbytes\n", (unsigned long)length >> 20);
> --
> 2.56.0.rc1.315.gc6ed9934b7-goog
>
--
Cheers, Lorenzo
prev parent reply other threads:[~2026-09-29 9:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 16:24 Carlos Llamas
2026-09-27 20:12 ` Andrew Morton
2026-09-28 5:01 ` Sarthak Sharma
2026-09-28 17:44 ` SJ Park
2026-09-29 9:11 ` Lorenzo Stoakes (ARM) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aruA14n4S_gnCRd9@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cmllamas@google.com \
--cc=david@kernel.org \
--cc=kernel-team@android.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®