All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf()
Date: Wed, 17 Apr 2019 16:49:13 +0000	[thread overview]
Message-ID: <A3C4DDC9-8E20-488C-A273-E3AE163A9774@fb.com> (raw)
In-Reply-To: <20190417145539.11669-1-jolsa@kernel.org>



> 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
> 


  reply	other threads:[~2019-04-17 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-04-17 17:37   ` Arnaldo Carvalho de Melo
2019-04-19 17:20 ` [tip:perf/urgent] " tip-bot for Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A3C4DDC9-8E20-488C-A273-E3AE163A9774@fb.com \
    --to=songliubraving@fb.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.