[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3688fd0f-4e59-44d4-5fdf-c92bc6b0916d@linux.intel.com>
Date: Tue, 16 May 2023 13:14:01 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Ian Rogers <irogers@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Kajol Jain <kjain@...ux.ibm.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf metrics: Avoid segv with --topdown
On 2023-05-15 6:45 p.m., Ian Rogers wrote:
> Some metrics may not have a metric_group which can result in segvs
> with "perf stat --topdown". Add a condition for the no metric_group
> case.
>
> Fixes: 1647cd5b8802 ("perf stat: Implement --topdown using json metrics")
> Reported-by: Kan Liang <kan.liang@...ux.intel.com>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
Tested-by: Kan Liang <kan.liang@...ux.intel.com>
Thanks,
Kan
> ---
> tools/perf/util/metricgroup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index 4e7d41d285b4..5e9c657dd3f7 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -1672,7 +1672,7 @@ static int metricgroup__topdown_max_level_callback(const struct pmu_metric *pm,
> {
> unsigned int *max_level = data;
> unsigned int level;
> - const char *p = strstr(pm->metric_group, "TopdownL");
> + const char *p = strstr(pm->metric_group ?: "", "TopdownL");
>
> if (!p || p[8] == '\0')
> return 0;
Powered by blists - more mailing lists