Skip to content

Commit f8ac1c4

Browse files
Thomas Richteracmel
authored andcommitted
perf bench numa: Address compiler error on s390
The compilation on s390 results in this error: # make DEBUG=y bench/numa.o ... bench/numa.c: In function ‘__bench_numa’: bench/numa.c:1749:81: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 10 and 20 [-Werror=format-truncation=] 1749 | snprintf(tname, sizeof(tname), "process%d:thread%d", p, t); ^~ ... bench/numa.c:1749:64: note: directive argument in the range [-2147483647, 2147483646] ... # The maximum length of the %d replacement is 11 characters because of the negative sign. Therefore extend the array by two more characters. Output after: # make DEBUG=y bench/numa.o > /dev/null 2>&1; ll bench/numa.o -rw-r--r-- 1 root root 418320 May 19 09:11 bench/numa.o # Fixes: 3aff8ba ("perf bench numa: Avoid possible truncation when using snprintf()") Suggested-by: Namhyung Kim <[email protected]> Signed-off-by: Thomas Richter <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Vasily Gorbik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent caaaa55 commit f8ac1c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/bench/numa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ static int __bench_numa(const char *name)
17401740
"GB/sec,", "total-speed", "GB/sec total speed");
17411741

17421742
if (g->p.show_details >= 2) {
1743-
char tname[14 + 2 * 10 + 1];
1743+
char tname[14 + 2 * 11 + 1];
17441744
struct thread_data *td;
17451745
for (p = 0; p < g->p.nr_proc; p++) {
17461746
for (t = 0; t < g->p.nr_threads; t++) {

0 commit comments

Comments
 (0)