[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250924044142.540162-1-wakel@google.com>
Date: Wed, 24 Sep 2025 12:41:42 +0800
From: Wake Liu <wakel@...gle.com>
To: "David S . Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Shuah Khan <shuah@...nel.org>,
netdev@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Simon Horman <horms@...nel.org>, Wake Liu <wakel@...gle.com>
Subject: [PATCH] Net: psock_tpacket: Fix null argument warning in walk_tx
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.
Signed-off-by: Wake Liu <wakel@...gle.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
Powered by blists - more mailing lists