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]
Message-ID: <CAADnVQJS_2St=iaqHU+zasy_0A0bidJN=STnkHrNcSNL5vO1Dg@mail.gmail.com>
Date:   Mon, 1 Nov 2021 15:00:11 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Yang Yingliang <yangyingliang@...wei.com>,
        Joanne Koong <joannekoong@...com>,
        Andrii Nakryiko <andrii@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>, Yonghong Song <yhs@...com>
Subject: Re: [PATCH -next v2] bpf/benchs: Fix return value check of bpf_program__attach()

On Mon, Nov 1, 2021 at 5:35 AM Yang Yingliang <yangyingliang@...wei.com> wrote:
>
> If bpf_program__attach() fails, it never returns NULL,
> we should use libbpf_get_error() to check the return value.
>
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> Acked-by: Yonghong Song <yhs@...com>
> ---
> v2:
>   don't use 'int err'
> ---
>  .../selftests/bpf/benchs/bench_bloom_filter_map.c      | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/benchs/bench_bloom_filter_map.c b/tools/testing/selftests/bpf/benchs/bench_bloom_filter_map.c
> index 6eeeed2913e6..4afaa4adb327 100644
> --- a/tools/testing/selftests/bpf/benchs/bench_bloom_filter_map.c
> +++ b/tools/testing/selftests/bpf/benchs/bench_bloom_filter_map.c
> @@ -304,7 +304,7 @@ static void bloom_lookup_setup(void)
>         populate_maps();
>
>         link = bpf_program__attach(ctx.skel->progs.bloom_lookup);
> -       if (!link) {
> +       if (libbpf_get_error(link)) {

Please use ASSERT_OK_PTR() instead.
See how other tests are doing it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ