summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/breakpoints/breakpoint_test.c
diff options
context:
space:
mode:
authorangquan yu <angquan21@gmail.com>2023-11-29 06:57:26 +0300
committerShuah Khan <skhan@linuxfoundation.org>2023-12-01 00:32:28 +0300
commite1c0b9ef26e5e46fd5c2df9e7f9686e786723f53 (patch)
treec29d35fda98d73f369db3b3836aace42679783c0 /tools/testing/selftests/breakpoints/breakpoint_test.c
parentb85ea95d086471afb4ad062012a4d73cd328fa86 (diff)
downloadlinux-e1c0b9ef26e5e46fd5c2df9e7f9686e786723f53.tar.xz
selftests:breakpoints: Fix Format String Warning in breakpoint_test
This commit resolves a compiler warning regardingthe use of non-literal format strings in breakpoint_test.c. The functions `ksft_test_result_pass` and `ksft_test_result_fail` were previously called with a variable `msg` directly, which could potentially lead to format string vulnerabilities. Changes made: - Modified the calls to `ksft_test_result_pass` and `ksft_test_result_fail` by adding a "%s" format specifier. This explicitly declares `msg` as a string argument, adhering to safer coding practices and resolving the compiler warning. This change does not affect the functional behavior of the code but ensures better code safety and compliance with recommended C programming standards. The previous warning is "breakpoint_test.c:287:17: warning: format not a string literal and no format arguments [-Wformat-security] 287 | ksft_test_result_pass(msg); | ^~~~~~~~~~~~~~~~~~~~~ breakpoint_test.c:289:17: warning: format not a string literal and no format arguments [-Wformat-security] 289 | ksft_test_result_fail(msg); | " Signed-off-by: angquan yu <angquan21@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/breakpoints/breakpoint_test.c')
-rw-r--r--tools/testing/selftests/breakpoints/breakpoint_test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/breakpoints/breakpoint_test.c b/tools/testing/selftests/breakpoints/breakpoint_test.c
index 3266cc9293fe..d46962a24724 100644
--- a/tools/testing/selftests/breakpoints/breakpoint_test.c
+++ b/tools/testing/selftests/breakpoints/breakpoint_test.c
@@ -284,9 +284,9 @@ static void check_success(const char *msg)
nr_tests++;
if (ret)
- ksft_test_result_pass(msg);
+ ksft_test_result_pass("%s", msg);
else
- ksft_test_result_fail(msg);
+ ksft_test_result_fail("%s", msg);
}
static void launch_instruction_breakpoints(char *buf, int local, int global)