Skip to content

Commit df73757

Browse files
shuahkhrostedt
authored andcommitted
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/[email protected] Cc: [email protected] Fixes: e23db80 ("tracing/tools: Add the latency-collector to tools directory") Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 59c22f7 commit df73757

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/tracing/latency/latency-collector.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -935,12 +935,12 @@ static void show_available(void)
935935
}
936936

937937
if (!tracers) {
938-
warnx(no_tracer_msg);
938+
warnx("%s", no_tracer_msg);
939939
return;
940940
}
941941

942942
if (!found) {
943-
warnx(no_latency_tr_msg);
943+
warnx("%s", no_latency_tr_msg);
944944
tracefs_list_free(tracers);
945945
return;
946946
}
@@ -983,7 +983,7 @@ static const char *find_default_tracer(void)
983983
for (i = 0; relevant_tracers[i]; i++) {
984984
valid = tracer_valid(relevant_tracers[i], &notracer);
985985
if (notracer)
986-
errx(EXIT_FAILURE, no_tracer_msg);
986+
errx(EXIT_FAILURE, "%s", no_tracer_msg);
987987
if (valid)
988988
return relevant_tracers[i];
989989
}
@@ -1878,7 +1878,7 @@ static void scan_arguments(int argc, char *argv[])
18781878
}
18791879
valid = tracer_valid(current_tracer, &notracer);
18801880
if (notracer)
1881-
errx(EXIT_FAILURE, no_tracer_msg);
1881+
errx(EXIT_FAILURE, "%s", no_tracer_msg);
18821882
if (!valid)
18831883
errx(EXIT_FAILURE,
18841884
"The tracer %s is not supported by your kernel!\n", current_tracer);

0 commit comments

Comments
 (0)