linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, namhyung@kernel.org, irogers@google.com,
	songliubraving@fb.com, yao.jin@linux.intel.com,
	linux-kernel@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: Re: [PATCH 3/3] perf annotate: Fix segfault with source toggle
Date: Mon, 20 Jan 2020 18:20:49 +0530	[thread overview]
Message-ID: <35f06ce1-9604-0cac-c6a7-6684a9a3d8dd@linux.ibm.com> (raw)
In-Reply-To: <20200120101246.GH608405@krava>



On 1/20/20 3:42 PM, Jiri Olsa wrote:
> On Fri, Jan 17, 2020 at 02:56:12PM +0530, Ravi Bangoria wrote:
>> While rendering annotate browser from perf report tui, we keep track
>> of total number of lines(asm + source) in annotation->nr_entries and
>> total number of asm lines in annotation->nr_asm_entries. But we don't
>> reset them before starting. Thus if user annotates same function
>> multiple times, we restart incrementing these fields with old values.
>>
>> This causes a segfault when user tries to toggle source code after
>> annotating same function multiple times. Fix it.
>>
>> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
>> ---
>>   tools/perf/util/annotate.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
>> index fe98d29dfbc4..df09c2070337 100644
>> --- a/tools/perf/util/annotate.c
>> +++ b/tools/perf/util/annotate.c
>> @@ -2610,6 +2610,8 @@ void annotation__set_offsets(struct annotation *notes, s64 size)
>>   	struct annotation_line *al;
>>   
>>   	notes->max_line_len = 0;
>> +	notes->nr_entries = 0;
>> +	notes->nr_asm_entries = 0;
> 
> seems fair ;-)
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks!

> 
> also could you please make that function static (in separate change)
> in your next repost?

Sure will do.

- Ravi


      reply	other threads:[~2020-01-20 12:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17  9:26 [PATCH 0/3] perf annotate: Misc fixes / improvements Ravi Bangoria
2020-01-17  9:26 ` [PATCH 1/3] perf annotate: Nuke privsize Ravi Bangoria
2020-01-20 10:08   ` Jiri Olsa
2020-01-20 12:49     ` Ravi Bangoria
2020-01-17  9:26 ` [PATCH 2/3] perf annotate: Align struct annotate_args Ravi Bangoria
2020-01-17  9:26 ` [PATCH 3/3] perf annotate: Fix segfault with source toggle Ravi Bangoria
2020-01-20 10:12   ` Jiri Olsa
2020-01-20 12:50     ` Ravi Bangoria [this message]

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=35f06ce1-9604-0cac-c6a7-6684a9a3d8dd@linux.ibm.com \
    --to=ravi.bangoria@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yao.jin@linux.intel.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).