Skip to content

Commit 0f995f2

Browse files
Andre-ARMctmarinas
authored andcommitted
kselftest/arm64: mte: use string literal for printf-style functions
Using pointers for the format specifier strings in printf-style functions can create potential security problems, as the number of arguments to be parsed could vary from call to call. Most compilers consequently warn about those: "format not a string literal and no format arguments [-Wformat-security]" If we only want to print a constant string, we can just use a fixed "%s" format instead, and pass the string as an argument. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20240816153251.2833702-5-andre.przywara@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent bf52ca5 commit 0f995f2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tools/testing/selftests/arm64/mte/mte_common_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ static inline void evaluate_test(int err, const char *msg)
7777
{
7878
switch (err) {
7979
case KSFT_PASS:
80-
ksft_test_result_pass(msg);
80+
ksft_test_result_pass("%s", msg);
8181
break;
8282
case KSFT_FAIL:
83-
ksft_test_result_fail(msg);
83+
ksft_test_result_fail("%s", msg);
8484
break;
8585
case KSFT_SKIP:
86-
ksft_test_result_skip(msg);
86+
ksft_test_result_skip("%s", msg);
8787
break;
8888
default:
8989
ksft_test_result_error("Unknown return code %d from %s",

0 commit comments

Comments
 (0)