linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: John Fastabend <john.fastabend@gmail.com>,
	Yu Kuai <yukuai3@huawei.com>,
	shuah@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org
Cc: linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	yukuai3@huawei.com, yi.zhang@huawei.com
Subject: RE: [PATCH] selftests/bpf: Fix return value check in attach_bpf()
Date: Fri, 28 May 2021 14:19:15 -0700	[thread overview]
Message-ID: <60b15e53d4396_303a420875@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <60b15da184eef_303a420848@john-XPS-13-9370.notmuch>

John Fastabend wrote:
> Yu Kuai wrote:
> > use libbpf_get_error() to check the return value of
> > bpf_program__attach().
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> > ---
> >  tools/testing/selftests/bpf/benchs/bench_rename.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/benchs/bench_rename.c b/tools/testing/selftests/bpf/benchs/bench_rename.c
> > index c7ec114eca56..b7d4a1d74fca 100644
> > --- a/tools/testing/selftests/bpf/benchs/bench_rename.c
> > +++ b/tools/testing/selftests/bpf/benchs/bench_rename.c
> > @@ -65,7 +65,7 @@ static void attach_bpf(struct bpf_program *prog)
> >  	struct bpf_link *link;
> >  
> >  	link = bpf_program__attach(prog);
> > -	if (!link) {
> > +	if (libbpf_get_error(link)) {
> >  		fprintf(stderr, "failed to attach program!\n");
> >  		exit(1);
> >  	}
> > -- 
> 
> Probably should be IS_ERR(link) same as the other benchs/*.c progs.

Oops on wrong branch, agree with Daniel looks fine as !link otherwise
need an explanation and fix the rest of the cases.

      reply	other threads:[~2021-05-28 21:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  9:07 [PATCH] selftests/bpf: Fix return value check in attach_bpf() Yu Kuai
2021-05-28 20:46 ` Daniel Borkmann
2021-05-29  1:25   ` yukuai (C)
2021-05-30  1:17     ` Andrii Nakryiko
2021-05-28 21:16 ` John Fastabend
2021-05-28 21:19   ` John Fastabend [this message]

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=60b15e53d4396_303a420875@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).