From: He Kuang <hekuang@huawei.com>
To: <acme@kernel.org>
Cc: <a.p.zijlstra@chello.nl>, <mingo@redhat.com>,
<wangnan0@huawei.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] perf hists browser: Fix segfault when all entries be filtered
Date: Wed, 4 Mar 2015 12:13:36 +0800 [thread overview]
Message-ID: <1425442416-29035-1-git-send-email-hekuang@huawei.com> (raw)
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 --------
../bin/perf[0x4d1858]
../lib64/libc.so.6(+0x3545f)[0x7fe72fc1145f]
../bin/perf[0x4cd9f5]
../bin/perf[0x4ce176]
../bin/perf[0x4d0506]
../bin/perf[0x41a94f]
../bin/perf[0x408cf2]
../bin/perf[0x408455]
../lib64/libc.so.6(__libc_start_main+0xf4)[0x7fe72fbfdbd4]
../bin/perf[0x408584]
Signed-off-by: He Kuang <hekuang@huawei.com>
---
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.
*/
do_offset:
+ if (!nd)
+ return;
+
if (offset > 0) {
do {
h = rb_entry(nd, struct hist_entry, rb_node);
--
2.2.0.33.gc18b867
next reply other threads:[~2015-03-04 4:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 4:13 He Kuang [this message]
2015-03-10 3:38 ` He Kuang
2015-03-10 6:01 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425442416-29035-1-git-send-email-hekuang@huawei.com \
--to=hekuang@huawei.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®