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

perf stat: Expand metric+unit buffer size

Long metric names combined with units may exceed the metric_bf and
lead to truncation. Double metric_bf in size to avoid this.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Kan Liang <kan.liang@linux.intel.com>
Link: https://lore.kernel.org/r/20241106004818.2174593-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
62a6d092 d8c0f8b4

+1 -1
+1 -1
tools/perf/util/stat-shadow.c
··· 517 517 if (!metric_events[i]) { 518 518 if (expr__parse(&ratio, pctx, metric_expr) == 0) { 519 519 char *unit; 520 - char metric_bf[64]; 520 + char metric_bf[128]; 521 521 522 522 if (metric_threshold && 523 523 expr__parse(&threshold, pctx, metric_threshold) == 0 &&