public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] selftests: net: csum: Fix printk format in recv_get_packet_csum_status()
Date: Fri, 16 Jan 2026 11:13:03 +0100	[thread overview]
Message-ID: <f6fef672-a657-451c-b60e-d9786f743cc4@bootlin.com> (raw)
In-Reply-To: <8b69b40826553c1dd500d9d25e45883744f3f348.1768556791.git.chleroy@kernel.org>

Hi Christophe

On 16/01/2026 10:48, Christophe Leroy (CS GROUP) wrote:
> Following warning is encountered when building selftests on powerpc/32.
> 
>   CC       csum
> csum.c: In function 'recv_get_packet_csum_status':
> csum.c:710:50: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
>   710 |                         error(1, 0, "cmsg: len=%lu expected=%lu",
>       |                                                ~~^
>       |                                                  |
>       |                                                  long unsigned int
>       |                                                %u
>   711 |                               cm->cmsg_len, CMSG_LEN(sizeof(struct tpacket_auxdata)));
>       |                               ~~~~~~~~~~~~
>       |                                 |
>       |                                 size_t {aka unsigned int}
> csum.c:710:63: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Wformat=]
>   710 |                         error(1, 0, "cmsg: len=%lu expected=%lu",
>       |                                                             ~~^
>       |                                                               |
>       |                                                               long unsigned int
>       |                                                             %u
> 
> cm->cmsg_len has type __kernel_size_t and CMSG() macro has the type
> returned by sizeof() which is size_t.
> 
> size_t is 'unsigned int' on some platforms and 'unsigned long' on
> other ones so use %zu instead of %lu.
> 
> This fixes commit 91a7de85600d ("selftests/net: add csum offload test").
> 
> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
> v2: Removed use %zu instead of %u and removed Fixes tag
> ---
>  tools/testing/selftests/net/lib/csum.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/lib/csum.c b/tools/testing/selftests/net/lib/csum.c
> index 27437590eeb53..e28884ce3ab39 100644
> --- a/tools/testing/selftests/net/lib/csum.c
> +++ b/tools/testing/selftests/net/lib/csum.c
> @@ -707,7 +707,7 @@ static uint32_t recv_get_packet_csum_status(struct msghdr *msg)
>  			      cm->cmsg_level, cm->cmsg_type);
>  
>  		if (cm->cmsg_len != CMSG_LEN(sizeof(struct tpacket_auxdata)))
> -			error(1, 0, "cmsg: len=%lu expected=%lu",
> +			error(1, 0, "cmsg: len=%zu expected=%zu",
>  			      cm->cmsg_len, CMSG_LEN(sizeof(struct tpacket_auxdata)));
>  
>  		aux = (void *)CMSG_DATA(cm);


  reply	other threads:[~2026-01-16 10:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16  9:48 [PATCH net-next v2] selftests: net: csum: Fix printk format in recv_get_packet_csum_status() Christophe Leroy (CS GROUP)
2026-01-16 10:13 ` Maxime Chevallier [this message]
2026-01-19 18:20 ` patchwork-bot+netdevbpf

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=f6fef672-a657-451c-b60e-d9786f743cc4@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=chleroy@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@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