From: Jiri Olsa Date: Wed, 17 Apr 2019 14:55:39 +0000 (+0200) Subject: perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf() X-Git-Tag: v5.4-rc1~1202^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2db7b1e0bd49d2b0e7d16949e167b1cfaf5c07cf;p=platform%2Fkernel%2Flinux-rpi.git perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf() We don't return NULL when we don't find the bpf_prog_info_node, fix that. Signed-off-by: Jiri Olsa Reported-by: Song Liu Acked-by: Song Liu Cc: Alexander Shishkin Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: 3792cb2ff43b ("perf bpf: Save BTF in a rbtree in perf_env") Link: http://lkml.kernel.org/r/20190417145539.11669-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 34a363f2..9494f9d 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -111,10 +111,12 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id) else if (btf_id > node->id) n = n->rb_right; else - break; + goto out; } + node = NULL; up_read(&env->bpf_progs.lock); +out: return node; }