🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
4 messages
4 total messages Started by Sasha Levin Tue, 03 Nov 2026 15:55
[PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
#10510
Author: Sasha Levin
Date: Tue, 03 Nov 2026 15:55
35 lines
8742 bytes
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
Re: [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
#10585
Author: Matthieu Baerts
Date: Tue, 03 Nov 2026 17:10
21 lines
11711 bytes
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.
Re: [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
#10733
Author: Hangbin Liu
Date: Wed, 04 Nov 2026 01:37
39 lines
9901 bytes
On Tue, Nov 03, 2026 at 10:55:06AM -0500, 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.
> 
> 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
> 

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Re: [PATCH] selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
#12353
Author: patchwork-bot+netdevbpf
Date: Fri, 06 Nov 2026 22:50
24 lines
8633 bytes
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  3 Nov 2026 10:55:06 -0500 you 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.
> 
> [...]

Here is the summary with links:
  - selftests: mptcp: pm_nl_ctl: print sizeof() with %zu
    https://git.kernel.org/netdev/net-next/c/1146fbb8024b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads