diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-11-14 16:25:38 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-11-18 13:01:59 -0300 |
commit | aceb98261ea7d9fe38f9c140c5531f0b13623832 (patch) | |
tree | a7e567718804d1af916498e7a89f6bd80f552f33 | |
parent | a7c2b572e217418ad34441202ad3addd8f94d2ea (diff) |
perf callchain: Fix segfault in thread__resolve_callchain_sample()
Do not dereference 'chain' when it is NULL.
$ perf record -e intel_pt//u -e branch-misses:u uname
$ perf report --itrace=l --branch-history
perf: Segmentation fault
Fixes: e9024d519d89 ("perf callchain: Honour the ordering of PERF_CONTEXT_{USER,KERNEL,etc}")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20191114142538.4097-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/machine.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 7d2e211e376c..71ee078d30f4 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2385,7 +2385,7 @@ static int thread__resolve_callchain_sample(struct thread *thread, } check_calls: - if (callchain_param.order != ORDER_CALLEE) { + if (chain && callchain_param.order != ORDER_CALLEE) { err = find_prev_cpumode(chain, thread, cursor, parent, root_al, &cpumode, chain->nr - first_call); if (err) |