summaryrefslogtreecommitdiffstats
path: root/tools/perf/arch
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-05-24 04:28:59 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-30 17:41:44 +0200
commitc45628b0a3f90c4ffeca5f72f227008ceedc21c5 (patch)
treeda39888cd2388ca752f09e48909520d0bc9e524a /tools/perf/arch
parentperf tools: Per event max-stack settings (diff)
downloadlinux-c45628b0a3f90c4ffeca5f72f227008ceedc21c5.tar.xz
linux-c45628b0a3f90c4ffeca5f72f227008ceedc21c5.zip
perf record: Robustify perf_event__synth_time_conv()
It is possible that all events in an evlist are overwritable. perf_event__synth_time_conv() should not crash in this case. record__pick_pc() is used to check avaliability. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1464056944-166978-3-git-send-email-wangnan0@huawei.com Signed-off-by: He Kuang <hekuang@huawei.com> [ Split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/arch')
-rw-r--r--tools/perf/arch/x86/util/tsc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c
index 357f1b13b5ae..2e5567c94e09 100644
--- a/tools/perf/arch/x86/util/tsc.c
+++ b/tools/perf/arch/x86/util/tsc.c
@@ -62,6 +62,8 @@ int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc,
struct perf_tsc_conversion tc;
int err;
+ if (!pc)
+ return 0;
err = perf_read_tsc_conversion(pc, &tc);
if (err == -EOPNOTSUPP)
return 0;