All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Wake Liu <wakel@google.com>,
	 "David S . Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,  Shuah Khan <shuah@kernel.org>,
	 netdev@vger.kernel.org,  linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Cc: Simon Horman <horms@kernel.org>,  Wake Liu <wakel@google.com>
Subject: Re: [PATCH] Net: psock_tpacket: Fix null argument warning in walk_tx
Date: Wed, 24 Sep 2025 16:21:07 -0400	[thread overview]
Message-ID: <willemdebruijn.kernel.2b5618e3b2d34@gmail.com> (raw)
In-Reply-To: <20250924044142.540162-1-wakel@google.com>

[PATCH net-next]

Wake Liu wrote:
> The sendto() call in walk_tx() was passing NULL as the buffer argument,
> which can trigger a -Wnonnull warning with some compilers.
> 
> Although the size is 0 and no data is actually sent, passing a null
> pointer is technically incorrect.
> 
> This commit changes NULL to an empty string literal ("") to satisfy the
> non-null argument requirement and fix the compiler warning.

Which library defines this argument as nonnull?

I'm not aware of this restriction in the POSIX standard.
This pattern is quite common.

> 
> Signed-off-by: Wake Liu <wakel@google.com>
> ---
>  tools/testing/selftests/net/psock_tpacket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/net/psock_tpacket.c b/tools/testing/selftests/net/psock_tpacket.c
> index 221270cee3ea..0c24adbb292e 100644
> --- a/tools/testing/selftests/net/psock_tpacket.c
> +++ b/tools/testing/selftests/net/psock_tpacket.c
> @@ -470,7 +470,7 @@ static void walk_tx(int sock, struct ring *ring)
>  
>  	bug_on(total_packets != 0);
>  
> -	ret = sendto(sock, NULL, 0, 0, NULL, 0);
> +	ret = sendto(sock, "", 0, 0, NULL, 0);
>  	if (ret == -1) {
>  		perror("sendto");
>  		exit(1);
> -- 
> 2.51.0.534.gc79095c0ca-goog
> 



      reply	other threads:[~2025-09-24 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24  4:41 [PATCH] Net: psock_tpacket: Fix null argument warning in walk_tx Wake Liu
2025-09-24 20:21 ` Willem de Bruijn [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=willemdebruijn.kernel.2b5618e3b2d34@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --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 \
    --cc=wakel@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.