lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue,  9 Apr 2024 15:42:56 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Kees Cook <keescook@...omium.org>, Shuah Khan <shuah@...nel.org>, 
	Nathan Chancellor <nathan@...nel.org>
Cc: linux-kselftest@...r.kernel.org, llvm@...ts.linux.dev, 
	linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>, 
	Sean Christopherson <seanjc@...gle.com>
Subject: [PATCH] selftests: kselftest_harness: Print empty string, not empty
 fmt on PASS/FAIL

When printing nothing for the diagnostic on PASS/FAIL, use a string format
with an empty string, not an empty format with a NULL parameter.  Clang
complains about the empty format string, which in turn breaks building
with -Werror.

./kselftest_harness.h:1205:30: error: format string is empty [-Werror,-Wformat-zero-length]
                              diagnostic ? "%s" : "", diagnostic);
                                                  ^~
Fixes: 378193eff339 ("selftests: kselftest_harness: let PASS / FAIL provide diagnostic")
Cc: Kees Cook <keescook@...omium.org>
Cc: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Sean Christopherson <seanjc@...gle.com>
---
 tools/testing/selftests/kselftest_harness.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 4fd735e48ee7..79ac9e9ada33 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -1197,12 +1197,11 @@ void __run_test(struct __fixture_metadata *f,
 	if (t->results->reason[0])
 		diagnostic = t->results->reason;
 	else if (t->exit_code == KSFT_PASS || t->exit_code == KSFT_FAIL)
-		diagnostic = NULL;
+		diagnostic = "";
 	else
 		diagnostic = "unknown";
 
-	ksft_test_result_code(t->exit_code, test_name,
-			      diagnostic ? "%s" : "", diagnostic);
+	ksft_test_result_code(t->exit_code, test_name, "%s", diagnostic);
 }
 
 static int test_harness_run(int argc, char **argv)

base-commit: 2c71fdf02a95b3dd425b42f28fd47fb2b1d22702
-- 
2.44.0.478.gd926399ef9-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ