Re: [PATCH] perf hists browser: Fix segfault when all entries be filtered

From: He Kuang
Date: Mon Mar 09 2015 - 23:39:29 EST

On 2015/3/4 12:13, He Kuang wrote:
When all perf report entries be filtered, the result of
hists__filter_entries() can be NULL, check the result before processing.

Miss this checking will cause segmentation fault like this:

$ perf report

(filter all entries and left nothing, then zoom in/out)
perf: Segmentation fault
-------- backtrace --------

Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
tools/perf/ui/browsers/hists.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 788506e..1106bb8 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -992,6 +992,9 @@ static void ui_browser__hists_seek(struct ui_browser *browser,
* and stop when we printed enough lines to fill the screen.
+ if (!nd)
+ return;
if (offset > 0) {
do {
h = rb_entry(nd, struct hist_entry, rb_node);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at