[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <35f06ce1-9604-0cac-c6a7-6684a9a3d8dd@linux.ibm.com>
Date: Mon, 20 Jan 2020 18:20:49 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: acme@...nel.org, namhyung@...nel.org, irogers@...gle.com,
songliubraving@...com, yao.jin@...ux.intel.com,
linux-kernel@...r.kernel.org,
Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Subject: Re: [PATCH 3/3] perf annotate: Fix segfault with source toggle
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@...ux.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@...hat.com>
Thanks!
>
> also could you please make that function static (in separate change)
> in your next repost?
Sure will do.
- Ravi
Powered by blists - more mailing lists