]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info()
authorJiri Olsa <jolsa@kernel.org>
Tue, 16 Apr 2019 13:41:51 +0000 (15:41 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 17 Apr 2019 17:30:06 +0000 (14:30 -0300)
We currently don't return NULL in case we don't find the
bpf_prog_info_node, fixing that.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 8aae545b2fa7 ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
Link: http://lkml.kernel.org/r/20190416134151.15282-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/env.c

index c6351b557bb0a9afb70d2ed4330c3496c3266a35..34a363f2e71bc0a79838686dd893bbca0ec4142a 100644 (file)
@@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
                else if (prog_id > node->info_linear->info.id)
                        n = n->rb_right;
                else
-                       break;
+                       goto out;
        }
+       node = NULL;
 
+out:
        up_read(&env->bpf_progs.lock);
        return node;
 }