[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200124080432.8065-5-ravi.bangoria@linux.ibm.com>
Date: Fri, 24 Jan 2020 13:34:30 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: acme@...nel.org, jolsa@...hat.com
Cc: 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: [PATCH v2 4/6] perf annotate: Fix segfault with source toggle
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>
Acked-by: Jiri Olsa <jolsa@...hat.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 d4a130d5913a..58e2c51e9d62 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2616,6 +2616,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;
list_for_each_entry(al, ¬es->src->source, node) {
size_t line_len = strlen(al->line);
--
2.24.1
Powered by blists - more mailing lists