Skip to contentSkip to conversation

selftests/filesystems: Fix build warning on anon_inode_test

PATCH New Ranganath V N 1 participant 2 messages Jul 30, 2025 – Sep 10, 2025 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/filesystems: Fix build warning on anon_inode_test

clang warning null passed where non-null argument is expected.

anon_inode_test.c:45:19: warning: argument 3 null where non-null expected [-Wnonnull]

   45 |         ASSERT_LT(execveat(fd_context, "", NULL, NULL, AT_EMPTY_PATH), 0);
      |                   ^~~~~~~~
---
 tools/testing/selftests/filesystems/anon_inode_test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/filesystems/anon_inode_test.c +3 -1
index 73e0a4d4fb2f..f796dad679db 100644
@@ -38,11 +38,13 @@ TEST(anon_inode_no_chmod)
 TEST(anon_inode_no_exec)
 {
 	int fd_context;
+	static char *argv[] = { NULL };
+	static char *envp[] = { NULL };
 
 	fd_context = sys_fsopen("tmpfs", 0);
 	ASSERT_GE(fd_context, 0);
 
-	ASSERT_LT(execveat(fd_context, "", NULL, NULL, AT_EMPTY_PATH), 0);
+	ASSERT_LT(execveat(fd_context, "", argv, envp, AT_EMPTY_PATH), 0);
 	ASSERT_EQ(errno, EACCES);
 
 	EXPECT_EQ(close(fd_context), 0);
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 selftests/filesystems: Fix build warning on anon_inode_test

Quoted 20 lines

clang warning null passed where non-null argument is expected.

anon_inode_test.c:45:19: warning: argument 3 null where non-null expected [-Wnonnull]

  45 |         ASSERT_LT(execveat(fd_context, "", NULL, NULL, AT_EMPTY_PATH), 0);
     |                   ^~~~~~~~

---
tools/testing/selftests/filesystems/anon_inode_test.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/filesystems/anon_inode_test.c +1 -0
index 73e0a4d4fb2f..f796dad679db 100644
@@ -38,11 +38,13 @@ TEST(anon_inode_no_chmod)
 TEST(anon_inode_no_exec)
 {
 	int fd_context;
+	static char *argv[] = { NULL };

tools/testing/selftests/filesystems/anon_inode_test.c TEST(anon_inode_no_chmod) · line 50

Quoted 10 lines
tools/testing/selftests/filesystems/anon_inode_test.c +2 -1
+	static char *envp[] = { NULL };
 
 	fd_context = sys_fsopen("tmpfs", 0);
 	ASSERT_GE(fd_context, 0);
 
-	ASSERT_LT(execveat(fd_context, "", NULL, NULL, AT_EMPTY_PATH), 0);
+	ASSERT_LT(execveat(fd_context, "", argv, envp, AT_EMPTY_PATH), 0);
 	ASSERT_EQ(errno, EACCES);
 
 	EXPECT_EQ(close(fd_context), 0);

Hi,
Please let me know the feedback for this patch.

Thanks,
Ranganath