mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/arm64: Prevent build warnings from -Wmaybe-uninitialized
@ 2025-06-25  2:01 Anshuman Khandual
  2025-06-25 10:24 ` Mark Brown
  2025-07-07 13:10 ` Thomas Weißschuh
  0 siblings, 2 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-06-25  2:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Shuah Khan,
	Mark Brown, linux-kselftest, linux-kernel

Arguments passed into WEXITSTATUS() should have been initialized earlier.
Otherwise following warning show up while building platform selftests on
arm64. Hence just zero out all the relevant local variables to avoid the
build warning.

Warning: ‘status’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.16-rc3

 tools/testing/selftests/arm64/abi/tpidr2.c    | 2 +-
 tools/testing/selftests/arm64/fp/za-fork.c    | 2 +-
 tools/testing/selftests/arm64/gcs/basic-gcs.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/arm64/abi/tpidr2.c b/tools/testing/selftests/arm64/abi/tpidr2.c
index eb19dcc37a755..389a60e5feabf 100644
--- a/tools/testing/selftests/arm64/abi/tpidr2.c
+++ b/tools/testing/selftests/arm64/abi/tpidr2.c
@@ -96,7 +96,7 @@ static int write_sleep_read(void)
 static int write_fork_read(void)
 {
 	pid_t newpid, waiting, oldpid;
-	int status;
+	int status = 0;
 
 	set_tpidr2(getpid());
 
diff --git a/tools/testing/selftests/arm64/fp/za-fork.c b/tools/testing/selftests/arm64/fp/za-fork.c
index 587b946482226..6098beb3515a0 100644
--- a/tools/testing/selftests/arm64/fp/za-fork.c
+++ b/tools/testing/selftests/arm64/fp/za-fork.c
@@ -24,7 +24,7 @@ int verify_fork(void);
 int fork_test_c(void)
 {
 	pid_t newpid, waiting;
-	int child_status, parent_result;
+	int child_status = 0, parent_result;
 
 	newpid = fork();
 	if (newpid == 0) {
diff --git a/tools/testing/selftests/arm64/gcs/basic-gcs.c b/tools/testing/selftests/arm64/gcs/basic-gcs.c
index 3fb9742342a34..2b350b6b7e12c 100644
--- a/tools/testing/selftests/arm64/gcs/basic-gcs.c
+++ b/tools/testing/selftests/arm64/gcs/basic-gcs.c
@@ -240,7 +240,7 @@ static bool map_guarded_stack(void)
 static bool test_fork(void)
 {
 	unsigned long child_mode;
-	int ret, status;
+	int ret, status = 0;
 	pid_t pid;
 	bool pass = true;
 
-- 
2.30.2


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

end of thread, other threads:[~2025-07-07 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-25  2:01 [PATCH] selftests/arm64: Prevent build warnings from -Wmaybe-uninitialized Anshuman Khandual
2025-06-25 10:24 ` Mark Brown
2025-06-27 10:45   ` Anshuman Khandual
2025-06-27 10:55     ` Mark Brown
2025-07-07 13:10 ` Thomas Weißschuh

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®