* [PATCH] selftests: tls: fix read/write of garbage value
@ 2025-11-29 6:37 Ankit Khushwaha
2025-11-29 10:22 ` Sabrina Dubroca
0 siblings, 1 reply; 3+ messages in thread
From: Ankit Khushwaha @ 2025-11-29 6:37 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman
Cc: Shuah Khan, netdev, linux-kselftest, linux-kernel,
Ankit Khushwaha
In 'poll_partial_rec_async' a uninitialized char variable 'token' with
*garbage* value is used for write/read instruction to synchronize
between threads via a pipe.
tls.c:2833:26: warning: variable 'token' is uninitialized
when passed as a const pointer argument here
[-Wuninitialized-const-pointer]
2833 | EXPECT_EQ(write(p[1], &token, 1), 1); /* Barrier #1 */
Initialize 'token' to '\0' to prevent write/read of garbage value.
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
---
compiler used: clang version 21.1.5 (Fedora 21.1.5-1.fc43).
---
tools/testing/selftests/net/tls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index a3ef4b57eb5f..a4d16a460fbe 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -2786,10 +2786,10 @@ TEST_F(tls_err, epoll_partial_rec)
TEST_F(tls_err, poll_partial_rec_async)
{
struct pollfd pfd = { };
+ char token = '\0';
ssize_t rec_len;
char rec[256];
char buf[128];
- char token;
int p[2];
int ret;
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests: tls: fix read/write of garbage value
2025-11-29 6:37 [PATCH] selftests: tls: fix read/write of garbage value Ankit Khushwaha
@ 2025-11-29 10:22 ` Sabrina Dubroca
2025-11-29 15:40 ` Ankit Khushwaha
0 siblings, 1 reply; 3+ messages in thread
From: Sabrina Dubroca @ 2025-11-29 10:22 UTC (permalink / raw)
To: Ankit Khushwaha
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, netdev, linux-kselftest, linux-kernel
2025-11-29, 12:07:26 +0530, Ankit Khushwaha wrote:
> In 'poll_partial_rec_async' a uninitialized char variable 'token' with
> *garbage* value is used for write/read instruction to synchronize
> between threads via a pipe.
>
> tls.c:2833:26: warning: variable 'token' is uninitialized
> when passed as a const pointer argument here
> [-Wuninitialized-const-pointer]
> 2833 | EXPECT_EQ(write(p[1], &token, 1), 1); /* Barrier #1 */
>
> Initialize 'token' to '\0' to prevent write/read of garbage value.
I'm not opposed to making the compiler happy, but in this case
"garbage" is completely fine, we don't care about the value.
So I think the subject and the commit message should talk about
"silencing a compiler warning" rather than "fixing use of garbage
value".
And your patch should indicate the target tree in the subject (here,
with [PATCH net-next]), see
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
--
Sabrina
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: tls: fix read/write of garbage value
2025-11-29 10:22 ` Sabrina Dubroca
@ 2025-11-29 15:40 ` Ankit Khushwaha
0 siblings, 0 replies; 3+ messages in thread
From: Ankit Khushwaha @ 2025-11-29 15:40 UTC (permalink / raw)
To: Sabrina Dubroca
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, netdev, linux-kselftest, linux-kernel
On Sat, Nov 29, 2025 at 11:22:06AM +0100, Sabrina Dubroca wrote:
> I'm not opposed to making the compiler happy, but in this case
> "garbage" is completely fine, we don't care about the value.
>
> So I think the subject and the commit message should talk about
> "silencing a compiler warning" rather than "fixing use of garbage
> value".
> And your patch should indicate the target tree in the subject (here,
> with [PATCH net-next]), see
> https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
Hi Sabrina,
thanks for the review, i will send a v2 patch with suggested changes.
--
Ankit
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-29 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-29 6:37 [PATCH] selftests: tls: fix read/write of garbage value Ankit Khushwaha
2025-11-29 10:22 ` Sabrina Dubroca
2025-11-29 15:40 ` Ankit Khushwaha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).