lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 May 2021 14:19:15 -0700
From:   John Fastabend <john.fastabend@...il.com>
To:     John Fastabend <john.fastabend@...il.com>,
        Yu Kuai <yukuai3@...wei.com>, shuah@...nel.org, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org
Cc:     linux-kselftest@...r.kernel.org, netdev@...r.kernel.org,
        bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
        yukuai3@...wei.com, yi.zhang@...wei.com
Subject: RE: [PATCH] selftests/bpf: Fix return value check in attach_bpf()

John Fastabend wrote:
> Yu Kuai wrote:
> > use libbpf_get_error() to check the return value of
> > bpf_program__attach().
> > 
> > Reported-by: Hulk Robot <hulkci@...wei.com>
> > Signed-off-by: Yu Kuai <yukuai3@...wei.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ