mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/fs/mount-notify: fix the indentation in the fsmount test
@ 2026-11-03 16:54 Sasha Levin
  2026-11-03 16:54 ` [PATCH] selftests/filesystems: remove the unused list_del() Sasha Levin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: Christian Brauner, Jan Kara
  Cc: Sasha Levin, Amir Goldstein, Miklos Szeredi, Shuah Khan,
	Nathan Chancellor, linux-fsdevel, linux-kselftest, llvm,
	linux-kernel

A few lines in the fsmount test are indented with spaces instead of a
tab. That puts them deeper than the ASSERT_*() in front of them, which
ends in a for loop with an empty body, so clang warns:

  mount-notify_test.c:338:18: warning: for loop has empty body [-Wempty-body]

Indent them with tabs.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with clang 21; KernelCI's clang builds show the same warnings.
Amir's pending fanotify series moves this file to filesystems/fanotify/,
and its rename still applies on top of this.

 .../filesystems/mount-notify/mount-notify_test.c          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
index 6381af6a40e30..6c95c275b1629 100644
--- a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
+++ b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
@@ -337,18 +337,18 @@ TEST_F(fanotify, fsmount)
 	fs = fsopen("tmpfs", 0);
 	ASSERT_GE(fs, 0);
 
-        ret = fsconfig(fs, FSCONFIG_CMD_CREATE, 0, 0, 0);
+	ret = fsconfig(fs, FSCONFIG_CMD_CREATE, 0, 0, 0);
 	ASSERT_EQ(ret, 0);
 
-        mnt = fsmount(fs, 0, 0);
+	mnt = fsmount(fs, 0, 0);
 	ASSERT_GE(mnt, 0);
 
-        close(fs);
+	close(fs);
 
 	ret = move_mount(mnt, "", AT_FDCWD, "/a", MOVE_MOUNT_F_EMPTY_PATH);
 	ASSERT_EQ(ret, 0);
 
-        close(mnt);
+	close(mnt);
 
 	mnts[1] = expect_notify_mask(_metadata, self, FAN_MNT_ATTACH);
 	ASSERT_NE(mnts[0], mnts[1]);
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] selftests/filesystems: remove the unused list_del()
  2026-11-03 16:54 [PATCH] selftests/fs/mount-notify: fix the indentation in the fsmount test Sasha Levin
@ 2026-11-03 16:54 ` Sasha Levin
  2026-11-03 16:54 ` [PATCH] selftests/statmount: initialize the byte written to the child Sasha Levin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Sasha Levin, Shuah Khan, Nathan Chancellor, linux-fsdevel,
	linux-kselftest, llvm, linux-kernel

Nothing uses list_del() in utils.c, and clang warns about it in each
test that builds utils.c with -Wall:

  ../utils.c:106:20: warning: unused function 'list_del' [-Wunused-function]

Remove it.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with clang 21; KernelCI's clang builds show the same warning.

 tools/testing/selftests/filesystems/utils.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/tools/testing/selftests/filesystems/utils.c b/tools/testing/selftests/filesystems/utils.c
index d73d7d8171db6..4321f1a552587 100644
--- a/tools/testing/selftests/filesystems/utils.c
+++ b/tools/testing/selftests/filesystems/utils.c
@@ -103,16 +103,6 @@ static inline void list_add_tail(struct list *head, struct list *list)
 	__list_add(list, head->prev, head);
 }
 
-static inline void list_del(struct list *list)
-{
-	struct list *next, *prev;
-
-	next = list->next;
-	prev = list->prev;
-	next->prev = prev;
-	prev->next = next;
-}
-
 static ssize_t read_nointr(int fd, void *buf, size_t count)
 {
 	ssize_t ret;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] selftests/statmount: initialize the byte written to the child
  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 ` Sasha Levin
  2026-11-03 16:54 ` [PATCH] selftests/namespaces: initialize the byte the children write Sasha Levin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Sasha Levin, Shuah Khan, Nathan Chancellor, linux-fsdevel,
	linux-kselftest, llvm, linux-kernel

test_listmount_ns() writes pval to the child only to let it exit, but
never sets it, and clang 21 warns:

  statmount_test_ns.c:334:35: warning: variable 'pval' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]

Initialize it to 0.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with clang 21; KernelCI's clang builds show the same warning.

 .../testing/selftests/filesystems/statmount/statmount_test_ns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c b/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c
index e500905e4c078..e7261d4f3be4e 100644
--- a/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c
+++ b/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c
@@ -275,7 +275,7 @@ static int validate_external_listmount(pid_t pid, uint64_t child_nr_mounts)
 static void test_listmount_ns(void)
 {
 	uint64_t nr_mounts;
-	char pval;
+	char pval = 0;
 	int child_ready_pipe[2];
 	int parent_ready_pipe[2];
 	pid_t pid;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] selftests/namespaces: initialize the byte the children write
  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
  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
  4 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Sasha Levin, Shuah Khan, Nathan Chancellor, linux-fsdevel,
	linux-kselftest, llvm, linux-kernel

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH nf-next] selftests: netfilter: nf_queue: drop the no-op loop initializer
  2026-11-03 16:54 [PATCH] selftests/fs/mount-notify: fix the indentation in the fsmount test Sasha Levin
                   ` (2 preceding siblings ...)
  2026-11-03 16:54 ` [PATCH] selftests/namespaces: initialize the byte the children write Sasha Levin
@ 2026-11-03 16:54 ` Sasha Levin
  2026-11-03 16:54 ` [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const Sasha Levin
  4 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal
  Cc: Sasha Levin, Phil Sutter, Fernando Fernandez Mancera,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Nathan Chancellor, netfilter-devel,
	coreteam, netdev, linux-kselftest, llvm, linux-kernel

The out-of-order verdict loop starts with "for (ooo_count; ...", and
clang warns about the unused expression:

  nf_queue.c:354:10: warning: expression result unused [-Wunused-value]

Leave the initializer empty.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
KernelCI's clang builds show this warning.

 tools/testing/selftests/net/netfilter/nf_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/netfilter/nf_queue.c b/tools/testing/selftests/net/netfilter/nf_queue.c
index cca6c3cfa9e46..bc0b2f601a0a4 100644
--- a/tools/testing/selftests/net/netfilter/nf_queue.c
+++ b/tools/testing/selftests/net/netfilter/nf_queue.c
@@ -351,7 +351,7 @@ static int mainloop(void)
 		if (opts.out_of_order) {
 			ooo_ids[ooo_count] = id;
 			if (ooo_count >= 15) {
-				for (ooo_count; ooo_count >= 0; ooo_count--) {
+				for (; ooo_count >= 0; ooo_count--) {
 					nlh = nfq_build_verdict(buf, ooo_ids[ooo_count],
 								opts.queue_num, opts.verdict);
 					if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next] selftests: net: tcp_ao: make the netstat column pointer const
  2026-11-03 16:54 [PATCH] selftests/fs/mount-notify: fix the indentation in the fsmount test Sasha Levin
                   ` (3 preceding siblings ...)
  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 ` Sasha Levin
  4 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-11-03 16:54 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Sasha Levin, Simon Horman, Dmitry Safonov, Shuah Khan, netdev,
	linux-kselftest, linux-kernel

lookup_get_column() stores the result of strchr() on a const string in
a plain char pointer. Since glibc 2.43, strchr() returns a const char
pointer for a const argument when C23 features are enabled, as they
are with _GNU_SOURCE, so gcc and clang warn:

  lib/proc.c:61:16: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

The pointer is only used to compute the length, so make it const.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with gcc 16 and clang 21 on glibc 2.43; KernelCI's gcc 15 builds
show the same warning.

 tools/testing/selftests/net/tcp_ao/lib/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/tcp_ao/lib/proc.c b/tools/testing/selftests/net/tcp_ao/lib/proc.c
index 8b984fa042869..50062b527a393 100644
--- a/tools/testing/selftests/net/tcp_ao/lib/proc.c
+++ b/tools/testing/selftests/net/tcp_ao/lib/proc.c
@@ -56,7 +56,7 @@ static struct netstat *lookup_get(struct netstat *ns,
 
 static struct netstat *lookup_get_column(struct netstat *ns, const char *line)
 {
-	char *column;
+	const char *column;
 
 	column = strchr(line, ':');
 	if (!column)
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-03 16:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH] selftests/namespaces: initialize the byte the children write Sasha Levin
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

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®