mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
perf stat: Avoid metric-only segv
[ Upstream commit 2543947c77e0e224bda86b4e7220c2f6714da463 ]
Cycles is recognized as part of a hard coded metric in stat-shadow.c,
it may call print_metric_only with a NULL fmt string leading to a
segfault. Handle the NULL fmt explicitly.
Fixes: 088519f318 ("perf stat: Move the display functions to stat-display.c")
Signed-off-by: Ian Rogers <[email protected]>
Reviewed-by: Kan Liang <[email protected]>
Cc: K Prateek Nayak <[email protected]>
Cc: James Clark <[email protected]>
Cc: Kaige Ye <[email protected]>
Cc: John Garry <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
9e411c40bd
commit
cf95808632
1 changed files with 1 additions and 1 deletions
|
|
@ -263,7 +263,7 @@ static void print_metric_only(struct perf_stat_config *config,
|
|||
if (color)
|
||||
mlen += strlen(color) + sizeof(PERF_COLOR_RESET) - 1;
|
||||
|
||||
color_snprintf(str, sizeof(str), color ?: "", fmt, val);
|
||||
color_snprintf(str, sizeof(str), color ?: "", fmt ?: "", val);
|
||||
fprintf(out, "%*s ", mlen, str);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue