All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf()
@ 2019-04-17 14:55 Jiri Olsa
  2019-04-17 16:49 ` Song Liu
  2019-04-19 17:20 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Olsa @ 2019-04-17 14:55 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Alexander Shishkin, Namhyung Kim, Peter Zijlstra, Song Liu, lkml,
	Ingo Molnar, Peter Zijlstra

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>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Fixes: 3792cb2ff43b ("perf bpf: Save BTF in a rbtree in perf_env")
Link: http://lkml.kernel.org/n/tip-99g9rg4p20a1o99vr0nkjhq8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/env.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index 34a363f2e71b..9494f9dc61ec 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;
 }
 
-- 
2.17.2


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

* Re: [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf()
  2019-04-17 14:55 [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf() Jiri Olsa
@ 2019-04-17 16:49 ` Song Liu
  2019-04-17 17:37   ` Arnaldo Carvalho de Melo
  2019-04-19 17:20 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
  1 sibling, 1 reply; 4+ messages in thread
From: Song Liu @ 2019-04-17 16:49 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Alexander Shishkin, Namhyung Kim,
	Peter Zijlstra, lkml, Ingo Molnar, Peter Zijlstra



> On Apr 17, 2019, at 7:55 AM, Jiri Olsa <jolsa@kernel.org> wrote:
> 
> 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>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Song Liu <songliubraving@fb.com>
> Fixes: 3792cb2ff43b ("perf bpf: Save BTF in a rbtree in perf_env")
> Link: http://lkml.kernel.org/n/tip-99g9rg4p20a1o99vr0nkjhq8@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Acked-by: Song Liu <songliubraving@fb.com>

Thanks again for the fix!

> ---
> tools/perf/util/env.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> index 34a363f2e71b..9494f9dc61ec 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;
> }
> 
> -- 
> 2.17.2
> 


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

* Re: [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf()
  2019-04-17 16:49 ` Song Liu
@ 2019-04-17 17:37   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-04-17 17:37 UTC (permalink / raw)
  To: Song Liu
  Cc: Jiri Olsa, Alexander Shishkin, Namhyung Kim, Peter Zijlstra,
	lkml, Ingo Molnar, Peter Zijlstra

Em Wed, Apr 17, 2019 at 04:49:13PM +0000, Song Liu escreveu:
> > On Apr 17, 2019, at 7:55 AM, Jiri Olsa <jolsa@kernel.org> wrote:
> > 
> > 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>
> > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Song Liu <songliubraving@fb.com>
> > Fixes: 3792cb2ff43b ("perf bpf: Save BTF in a rbtree in perf_env")
> > Link: http://lkml.kernel.org/n/tip-99g9rg4p20a1o99vr0nkjhq8@git.kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Acked-by: Song Liu <songliubraving@fb.com>

Thanks, applied.

- Arnaldo

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

* [tip:perf/urgent] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf()
  2019-04-17 14:55 [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf() Jiri Olsa
  2019-04-17 16:49 ` Song Liu
@ 2019-04-19 17:20 ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jiri Olsa @ 2019-04-19 17:20 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: alexander.shishkin, peterz, linux-kernel, hpa, namhyung, acme,
	songliubraving, jolsa, tglx, mingo

Commit-ID:  2db7b1e0bd49d2b0e7d16949e167b1cfaf5c07cf
Gitweb:     https://git.kernel.org/tip/2db7b1e0bd49d2b0e7d16949e167b1cfaf5c07cf
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 17 Apr 2019 16:55:39 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 17 Apr 2019 14:30:23 -0300

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 <jolsa@kernel.org>
Reported-by: Song Liu <songliubraving@fb.com>
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: 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 <acme@redhat.com>
---
 tools/perf/util/env.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index 34a363f2e71b..9494f9dc61ec 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;
 }
 

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

end of thread, other threads:[~2019-04-19 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 14:55 [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf() Jiri Olsa
2019-04-17 16:49 ` Song Liu
2019-04-17 17:37   ` Arnaldo Carvalho de Melo
2019-04-19 17:20 ` [tip:perf/urgent] " tip-bot for Jiri Olsa

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.