linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: namhyung@kernel.org, linux-kernel@vger.kernel.org,
	lizefan@huawei.com, pi3orama@163.com
Subject: Re: [PATCH v2] perf tools: Fix segfault in 'perf top'
Date: Mon, 14 Sep 2015 15:12:56 -0300	[thread overview]
Message-ID: <20150914181256.GD5250@kernel.org> (raw)
In-Reply-To: <20150914180714.GC5250@kernel.org>

Em Mon, Sep 14, 2015 at 03:07:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Sep 14, 2015 at 10:23:55AM +0000, Wang Nan escreveu:
> > 'perf top' segfaults with following operation:
> > 
> >  # perf top -e page-faults -p 11400 # 11400 never generates page-fault
> > 
> > Then on the resulting empty interface, press right key:
> 
> So, this happens in perf/urgent, so we need to apply it there first,
> which this patch doesn't.
> 
> I am fixing it up this time, thanks for the patch!

For reference, below is the resulting patch, pushed to acme/perf/urgent,
now checking if there are more patches to go together with this one...

- Arnaldo

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cf86f2d3a5e7..c04c60d4863c 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1968,7 +1968,8 @@ skip_annotation:
 					  &options[nr_options], dso);
 		nr_options += add_map_opt(browser, &actions[nr_options],
 					  &options[nr_options],
-					  browser->selection->map);
+					  browser->selection ?
+						browser->selection->map : NULL);
 
 		/* perf script support */
 		if (browser->he_selection) {
@@ -1976,6 +1977,15 @@ skip_annotation:
 						     &actions[nr_options],
 						     &options[nr_options],
 						     thread, NULL);
+			/*
+			 * Note that browser->selection != NULL
+			 * when browser->he_selection is not NULL,
+			 * so we don't need to check browser->selection
+			 * before fetching browser->selection->sym like what
+			 * we do before fetching browser->selection->map.
+			 *
+			 * See hist_browser__show_entry.
+			 */
 			nr_options += add_script_opt(browser,
 						     &actions[nr_options],
 						     &options[nr_options],

  reply	other threads:[~2015-09-14 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11  4:59 [PATCH] perf tools: Fix segfault in 'perf top' Wang Nan
2015-09-11 16:22 ` Namhyung Kim
2015-09-14 10:15   ` Wangnan (F)
2015-09-14 10:23   ` [PATCH v2] " Wang Nan
2015-09-14 18:07     ` Arnaldo Carvalho de Melo
2015-09-14 18:12       ` Arnaldo Carvalho de Melo [this message]
2015-09-16  7:27     ` [tip:perf/core] perf top: Fix segfault pressing -> with no hist entries tip-bot for Wang Nan

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=20150914181256.GD5250@kernel.org \
    --to=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=namhyung@kernel.org \
    --cc=pi3orama@163.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;
as well as URLs for NNTP newsgroup(s).