* [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
@ 2026-11-03 15:55 Sasha Levin
2026-11-03 17:10 ` Matthieu Baerts
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-11-03 15:55 UTC (permalink / raw)
To: Matthieu Baerts, Mat Martineau, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Geliang Tang, Simon Horman, Shuah Khan, netdev, mptcp,
linux-kselftest, linux-kernel
On 32-bit architectures size_t is an unsigned int, and printing
sizeof(struct nlmsgerr) with %ld warns:
pm_nl_ctl.c:73:71: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
Use %zu.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with a 32-bit build of the selftests with a 64-bit time_t (gcc 16
and clang 21 with -m32 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64);
KernelCI's 32-bit arm builds show the same warnings. The changed files
build without format warnings there now, and the x86_64 builds don't
change. The other selftests get the same kind of fix in separate
patches.
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
index 78180da1efcc5..36a6d39b31bbf 100644
--- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
+++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
@@ -70,7 +70,7 @@ static int nl_error(struct nlmsghdr *nh)
uint32_t off;
if (len < sizeof(struct nlmsgerr)) {
- error(1, 0, "netlink error message truncated %d min %ld", len,
+ error(1, 0, "netlink error message truncated %d min %zu", len,
sizeof(struct nlmsgerr));
return -1;
}
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
2026-11-03 15:55 [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu Sasha Levin
@ 2026-11-03 17:10 ` Matthieu Baerts
0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Baerts @ 2026-11-03 17:10 UTC (permalink / raw)
To: Sasha Levin
Cc: Mat Martineau, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Geliang Tang, Simon Horman, Shuah Khan, netdev,
mptcp, linux-kselftest, linux-kernel
Hi Sasha,
On 03/11/2026 16:55, Sasha Levin wrote:
> On 32-bit architectures size_t is an unsigned int, and printing
> sizeof(struct nlmsgerr) with %ld warns:
>
> pm_nl_ctl.c:73:71: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
>
> Use %zu.
Thank you for the fix, it looks good to me:
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
@Net maintainers: please apply this patch to net-next directly.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 15:55 [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu Sasha Levin
2026-11-03 17:10 ` Matthieu Baerts
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®