All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf probe: Fix --line option behavior
@ 2014-04-01  4:47 Namhyung Kim
  2014-04-01  5:01 ` Masami Hiramatsu
  2014-04-14 14:53 ` [tip:perf/urgent] perf probe: Fix --line option behavior tip-bot for Namhyung Kim
  0 siblings, 2 replies; 9+ messages in thread
From: Namhyung Kim @ 2014-04-01  4:47 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, Namhyung Kim,
	Namhyung Kim, LKML, Masami Hiramatsu

The commit 5a62257a3ddd1 ("perf probe: Replace line_list with
intlist") replaced line_list to intlist but it has a problem that if a
same line was added again, it'd return -EEXIST rather than 1.

Since line_range_walk_cb() only checks the result being negative, it
resulted in failure or segfault sometimes.

Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/probe-finder.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index df0238654698..3bf0c8cdccb7 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno,
 			      void *data)
 {
 	struct line_finder *lf = data;
+	int err;
 
 	if ((strtailcmp(fname, lf->fname) != 0) ||
 	    (lf->lno_s > lineno || lf->lno_e < lineno))
 		return 0;
 
-	if (line_range_add_line(fname, lineno, lf->lr) < 0)
-		return -EINVAL;
+	err = line_range_add_line(fname, lineno, lf->lr);
+	if (err < 0 && err != -EEXIST)
+		return err;
 
 	return 0;
 }
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-04-14 14:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01  4:47 [PATCH] perf probe: Fix --line option behavior Namhyung Kim
2014-04-01  5:01 ` Masami Hiramatsu
2014-04-01  7:21   ` Namhyung Kim
2014-04-01  7:40     ` Masami Hiramatsu
2014-04-02  5:48     ` [PATCH -tip ] [BUGFIX] perf/probe: Fix to handle errors in line_range searching Masami Hiramatsu
2014-04-06 12:52       ` Jiri Olsa
2014-04-07  5:29         ` Namhyung Kim
2014-04-14 14:53       ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
2014-04-14 14:53 ` [tip:perf/urgent] perf probe: Fix --line option behavior tip-bot for Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.