[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-de3d0f12be476271d03f1ddb5a7c241c2f07f126@git.kernel.org>
Date: Wed, 6 Dec 2017 08:40:20 -0800
From: tip-bot for Ganapatrao Kulkarni <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: gklkml16@...il.com, mark.rutland@....com,
zhangshaokun@...ilicon.com, hpa@...or.com, acme@...hat.com,
linux-kernel@...r.kernel.org, jonathan.cameron@...wei.com,
catalin.marinas@....com, tglx@...utronix.de,
robert.richter@...ium.com, will.deacon@....com,
jnair@...iumnetworks.com, ganapatrao.kulkarni@...ium.com,
mingo@...nel.org, peterz@...radead.org,
alexander.shishkin@...ux.intel.com
Subject: [tip:perf/core] perf pmu: Add check for valid cpuid in
perf_pmu__find_map()
Commit-ID: de3d0f12be476271d03f1ddb5a7c241c2f07f126
Gitweb: https://git.kernel.org/tip/de3d0f12be476271d03f1ddb5a7c241c2f07f126
Author: Ganapatrao Kulkarni <ganapatrao.kulkarni@...ium.com>
AuthorDate: Tue, 17 Oct 2017 00:02:22 +0530
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 5 Dec 2017 15:43:51 -0300
perf pmu: Add check for valid cpuid in perf_pmu__find_map()
On some platforms(arm/arm64) which uses cpus map to get corresponding
cpuid string, cpuid can be NULL for PMUs other than CORE PMUs. Adding
check for NULL cpuid in function perf_pmu__find_map to avoid
segmentation fault.
Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@...ium.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Ganapatrao Kulkarni <gklkml16@...il.com>
Cc: Jayachandran C <jnair@...iumnetworks.com>
Cc: Jonathan Cameron <jonathan.cameron@...wei.com>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Robert Richter <robert.richter@...ium.com>
Cc: Shaokun Zhang <zhangshaokun@...ilicon.com>
Cc: Will Deacon <will.deacon@....com>
Cc: linux-arm-kernel@...ts.infradead.org
Link: http://lkml.kernel.org/r/20171016183222.25750-6-ganapatrao.kulkarni@cavium.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/pmu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 732ff57..8b7c151 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -601,6 +601,12 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
char *cpuid = perf_pmu__getcpuid(pmu);
int i;
+ /* on some platforms which uses cpus map, cpuid can be NULL for
+ * PMUs other than CORE PMUs.
+ */
+ if (!cpuid)
+ return NULL;
+
i = 0;
for (;;) {
map = &pmu_events_map[i++];
Powered by blists - more mailing lists