From: Arnaldo Carvalho de Melo <a...@redhat.com>

The libtraceevent handler (session->tevent) is only initialized when
there are tracepoints in a perf.data event list, so do not call
pevent_set_function_resolve() in those cases, fixing a segfault.

Reported-by: Jiri Olsa <jo...@kernel.org>
Tested-by: Jiri Olsa <jo...@kernel.org>
Cc: Adrian Hunter <adrian.hun...@intel.com>
Cc: Borislav Petkov <b...@suse.de>
Cc: David Ahern <dsah...@gmail.com>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Stephane Eranian <eran...@google.com>
Link: http://lkml.kernel.org/n/tip-xyynkucl5p4bcs13zi4i4...@git.kernel.org
Report-link: http://lkml.kernel.org/r/20150803174113.ga20...@krava.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/perf/builtin-script.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index bd31380122f9..7912feb9a024 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1861,7 +1861,8 @@ int cmd_script(int argc, const char **argv, const char 
*prefix __maybe_unused)
        else
                symbol_conf.use_callchain = false;
 
-       if (pevent_set_function_resolver(session->tevent.pevent,
+       if (session->tevent.pevent &&
+           pevent_set_function_resolver(session->tevent.pevent,
                                         machine__resolve_kernel_addr,
                                         &session->machines.host) < 0) {
                pr_err("%s: failed to set libtraceevent function resolver\n", 
__func__);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to