[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bea4ad79-297e-9737-8af1-2286192d26f4@os.amperecomputing.com>
Date: Mon, 4 Dec 2023 14:44:54 -0800 (PST)
From: Ilkka Koskinen <ilkka@...amperecomputing.com>
To: Ian Rogers <irogers@...gle.com>
cc: John Garry <john.g.garry@...cle.com>,
Will Deacon <will@...nel.org>,
James Clark <james.clark@....com>,
Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...aro.org>,
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>,
Ilkka Koskinen <ilkka@...amperecomputing.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Kajol Jain <kjain@...ux.ibm.com>,
linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf metrics: Avoid segv if default metricgroup
isn't set
On Mon, 4 Dec 2023, Ian Rogers wrote:
> A metric is default by having "Default" within its groups. The default
> metricgroup name needn't be set and this can result in segv in
> default_metricgroup_cmp and perf_stat__print_shadow_stats_metricgroup
> that assume it has a value when there is a Default metric group. To
> avoid the segv initialize the value to "".
>
> Fixes: 1c0e47956a8e ("perf metrics: Sort the Default metricgroup")
> Signed-off-by: Ian Rogers <irogers@...gle.com>
Thanks! I was going to look for the bug but got pulled to other
tasks. The patch looks good to me and I tested it successfully on
AmpereOne.
Reviewed-and-tested-by: Ilkka Koskinen <ilkka@...amperecomputing.com>
Cheers, Ilkka
> ---
> 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 0484736d9fe4..ca3e0404f187 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -225,7 +225,7 @@ static struct metric *metric__new(const struct pmu_metric *pm,
>
> m->pmu = pm->pmu ?: "cpu";
> m->metric_name = pm->metric_name;
> - m->default_metricgroup_name = pm->default_metricgroup_name;
> + m->default_metricgroup_name = pm->default_metricgroup_name ?: "";
> m->modifier = NULL;
> if (modifier) {
> m->modifier = strdup(modifier);
> --
> 2.43.0.rc2.451.g8631bc7472-goog
>
>
Powered by blists - more mailing lists