mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	llvm@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/namespaces: initialize the byte the children write
Date: Tue,  3 Nov 2026 11:54:17 -0500	[thread overview]
Message-ID: <20261103165419.687806-4-sashal@kernel.org> (raw)
In-Reply-To: <20261103165419.687806-1-sashal@kernel.org>

The children in listns_pagination_bug and stress_test write c to the
parent only to say they are ready, but never set it, and clang 21
warns:

  stress_test.c:137:22: warning: variable 'c' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]

Initialize it to 'X', as the parent does with its byte.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with clang 21. The namespaces tests aren't in TARGETS in
tools/testing/selftests/Makefile, so CI doesn't build or run them. Is
that on purpose?

 tools/testing/selftests/namespaces/listns_pagination_bug.c | 2 +-
 tools/testing/selftests/namespaces/stress_test.c           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/namespaces/listns_pagination_bug.c b/tools/testing/selftests/namespaces/listns_pagination_bug.c
index da7d33f963972..6452825e88506 100644
--- a/tools/testing/selftests/namespaces/listns_pagination_bug.c
+++ b/tools/testing/selftests/namespaces/listns_pagination_bug.c
@@ -46,7 +46,7 @@ TEST(pagination_with_type_filter)
 		ASSERT_GE(pids[i], 0);
 
 		if (pids[i] == 0) {
-			char c;
+			char c = 'X';
 			close(sv[0]);
 
 			if (setup_userns() < 0) {
diff --git a/tools/testing/selftests/namespaces/stress_test.c b/tools/testing/selftests/namespaces/stress_test.c
index dd7df7d6cb277..6a27b98c5bc2a 100644
--- a/tools/testing/selftests/namespaces/stress_test.c
+++ b/tools/testing/selftests/namespaces/stress_test.c
@@ -124,7 +124,7 @@ TEST(many_concurrent_namespaces)
 
 		if (pids[i] == 0) {
 			/* Child: create user namespace and wait for parent signal */
-			char c;
+			char c = 'X';
 
 			close(sv[0]);
 
@@ -366,7 +366,7 @@ TEST(listns_pagination_stress)
 		ASSERT_GE(pids[i], 0);
 
 		if (pids[i] == 0) {
-			char c;
+			char c = 'X';
 			close(sv[0]);
 
 			if (setup_userns() < 0) {
-- 
2.53.0


  parent reply	other threads:[~2026-11-03 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 16:54 [PATCH] selftests/fs/mount-notify: fix the indentation in the fsmount test Sasha Levin
2026-11-03 16:54 ` [PATCH] selftests/filesystems: remove the unused list_del() Sasha Levin
2026-11-03 16:54 ` [PATCH] selftests/statmount: initialize the byte written to the child Sasha Levin
2026-11-03 16:54 ` Sasha Levin [this message]
2026-11-03 16:54 ` [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer Sasha Levin
2026-11-03 16:54 ` [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const Sasha Levin

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=20261103165419.687806-4-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --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

all inboxes | Powered by JetHome®