Re: [PATCH v2 09/43] perf stat: Avoid segv on counter->name

Arnaldo Carvalho de Melo
2023-04-29T01:20:29Z

Em Fri, Apr 28, 2023 at 12:37:35AM -0700, Ian Rogers escreveu:
> Switch to use evsel__name that doesn't return NULL for hardware and
> similar events.
>
> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
> Signed-off-by: Ian Rogers <irogers@google.com>

Thanks, applied.

- Arnaldo

> ---
> tools/perf/util/stat-display.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index df6337f2480b..7aa7e16fa7c4 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -748,7 +748,7 @@ static void uniquify_event_name(struct evsel *counter)
> int ret = 0;
>
> if (counter->uniquified_name || counter->use_config_name ||
> - !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
> + !counter->pmu_name || !strncmp(evsel__name(counter), counter->pmu_name,
> strlen(counter->pmu_name)))
> return;
>
> --
> 2.40.1.495.gc816e09b53d-goog
>

--

- Arnaldo