Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/latency-collector: Fix -Wformat-security compile warns

Fix the following -Wformat-security compile warnings adding missing
format arguments:

latency-collector.c: In function ‘show_available’:
latency-collector.c:938:17: warning: format not a string literal and
no format arguments [-Wformat-security]
938 | warnx(no_tracer_msg);
| ^~~~~

latency-collector.c:943:17: warning: format not a string literal and
no format arguments [-Wformat-security]
943 | warnx(no_latency_tr_msg);
| ^~~~~

latency-collector.c: In function ‘find_default_tracer’:
latency-collector.c:986:25: warning: format not a string literal and
no format arguments [-Wformat-security]
986 | errx(EXIT_FAILURE, no_tracer_msg);
|
^~~~
latency-collector.c: In function ‘scan_arguments’:
latency-collector.c:1881:33: warning: format not a string literal and
no format arguments [-Wformat-security]
1881 | errx(EXIT_FAILURE, no_tracer_msg);
| ^~~~

Link: https://lore.kernel.org/linux-trace-kernel/20240404011009.32945-1-skhan@linuxfoundation.org

Cc: stable@vger.kernel.org
Fixes: e23db805da2df ("tracing/tools: Add the latency-collector to tools directory")
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Shuah Khan and committed by
Steven Rostedt (Google)
df73757c 59c22f70

+4 -4
+4 -4
tools/tracing/latency/latency-collector.c
··· 935 935 } 936 936 937 937 if (!tracers) { 938 - warnx(no_tracer_msg); 938 + warnx("%s", no_tracer_msg); 939 939 return; 940 940 } 941 941 942 942 if (!found) { 943 - warnx(no_latency_tr_msg); 943 + warnx("%s", no_latency_tr_msg); 944 944 tracefs_list_free(tracers); 945 945 return; 946 946 } ··· 983 983 for (i = 0; relevant_tracers[i]; i++) { 984 984 valid = tracer_valid(relevant_tracers[i], &notracer); 985 985 if (notracer) 986 - errx(EXIT_FAILURE, no_tracer_msg); 986 + errx(EXIT_FAILURE, "%s", no_tracer_msg); 987 987 if (valid) 988 988 return relevant_tracers[i]; 989 989 } ··· 1878 1878 } 1879 1879 valid = tracer_valid(current_tracer, &notracer); 1880 1880 if (notracer) 1881 - errx(EXIT_FAILURE, no_tracer_msg); 1881 + errx(EXIT_FAILURE, "%s", no_tracer_msg); 1882 1882 if (!valid) 1883 1883 errx(EXIT_FAILURE, 1884 1884 "The tracer %s is not supported by your kernel!\n", current_tracer);