perf stat: Expand metric+unit buffer size
authorIan Rogers <irogers@google.com>
Wed, 6 Nov 2024 00:48:18 +0000 (16:48 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 7 Nov 2024 19:49:50 +0000 (11:49 -0800)
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>
tools/perf/util/stat-shadow.c

index ada787947e163e010161ef0d7250f091527b437d..47718610d5d8ccdf1e18de298269f894703a48c2 100644 (file)
@@ -517,7 +517,7 @@ static void generic_metric(struct perf_stat_config *config,
        if (!metric_events[i]) {
                if (expr__parse(&ratio, pctx, metric_expr) == 0) {
                        char *unit;
-                       char metric_bf[64];
+                       char metric_bf[128];
 
                        if (metric_threshold &&
                            expr__parse(&threshold, pctx, metric_threshold) == 0 &&