diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-10-13 18:02:20 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-10-13 18:02:20 +0200 |
commit | dbaa1b3d9afba3c050d365245a36616ae3f425a7 (patch) | |
tree | 5fc6bea725975062bfa6e818205685ecf85cfb78 /tools/perf/util/parse-events.c | |
parent | tools lib traceevent: Hide non API functions (diff) | |
parent | perf stat: Fix out of bounds CPU map access when handling armv8_pmu events (diff) | |
download | linux-dbaa1b3d9afba3c050d365245a36616ae3f425a7.tar.xz linux-dbaa1b3d9afba3c050d365245a36616ae3f425a7.zip |
Merge branch 'perf/urgent' into perf/core
To pick fixes that missed v5.9.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index f82ef1e840b2..3bcdf084df91 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -353,18 +353,20 @@ __add_event(struct list_head *list, int *idx, const char *cpu_list) { struct evsel *evsel; - struct perf_cpu_map *cpus = pmu ? pmu->cpus : + struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) : cpu_list ? perf_cpu_map__new(cpu_list) : NULL; if (init_attr) event_attr_init(attr); evsel = evsel__new_idx(attr, *idx); - if (!evsel) + if (!evsel) { + perf_cpu_map__put(cpus); return NULL; + } (*idx)++; - evsel->core.cpus = perf_cpu_map__get(cpus); + evsel->core.cpus = cpus; evsel->core.own_cpus = perf_cpu_map__get(cpus); evsel->core.system_wide = pmu ? pmu->is_uncore : false; evsel->auto_merge_stats = auto_merge_stats; |