Skip to content

Commit 8493fe1

Browse files
Jiri Olsaacmel
authored andcommitted
perf hists browser: Fix NULL deref in hists browsing code
If there's an event with no samples in data file, the perf report command can segfault after entering the event details menu. Following steps reproduce the issue: # ./perf record -e syscalls:sys_enter_kexec_load,syscalls:sys_enter_mmap ls # ./perf report # enter '0 syscalls:sys_enter_kexec_load' menu # pres ENTER twice Above steps are valid assuming ls wont run kexec.. ;) The check for sellection to be NULL is missing. The fix makes sure it's being check. Above steps now endup with menu being displayed allowing 'Exit' as the only option. Signed-off-by: Jiri Olsa <[email protected]> Cc: Corey Ashford <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 63fa471 commit 8493fe1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/perf/util/ui/browsers/hists.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ static int callchain__count_rows(struct rb_root *chain)
125125

126126
static bool map_symbol__toggle_fold(struct map_symbol *self)
127127
{
128+
if (!self)
129+
return false;
130+
128131
if (!self->has_children)
129132
return false;
130133

0 commit comments

Comments
 (0)