]> Git Repo - linux.git/commitdiff
perf probe: Fix --line option behavior
authorNamhyung Kim <[email protected]>
Tue, 1 Apr 2014 04:47:57 +0000 (13:47 +0900)
committerJiri Olsa <[email protected]>
Mon, 14 Apr 2014 10:55:39 +0000 (12:55 +0200)
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.

Signed-off-by: Namhyung Kim <[email protected]>
Acked-by: Masami Hiramatsu <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
tools/perf/util/probe-finder.c

index df0238654698d8967120f538a68b6aec5da18426..3bf0c8cdccb7225d3035eb32e55c81944686ec4f 100644 (file)
@@ -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;
 }
This page took 0.062954 seconds and 4 git commands to generate.