lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20171116192110.26817-2-andi@firstfloor.org>
Date:   Thu, 16 Nov 2017 11:21:09 -0800
From:   Andi Kleen <andi@...stfloor.org>
To:     acme@...nel.org
Cc:     jolsa@...nel.org, linux-kernel@...r.kernel.org,
        Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH v2 1/2] perf, tools: Add fallback in perf_evsel__nr_cpus for no map

From: Andi Kleen <ak@...ux.intel.com>

Support the case of the event having no cpumap in perf_evsel__nr_cpus.
Just return 1 in this case.  This can happen in perf script
when it uses the perf stat shadow functions.

Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
 tools/perf/util/evsel.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 0688880227e1..bfa25a1c72fe 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -161,7 +161,8 @@ static inline struct cpu_map *perf_evsel__cpus(struct perf_evsel *evsel)
 
 static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
 {
-	return perf_evsel__cpus(evsel)->nr;
+	struct cpu_map *map = perf_evsel__cpus(evsel);
+	return map ? map->nr : 1;
 }
 
 void perf_counts_values__scale(struct perf_counts_values *count,
-- 
2.13.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ