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] [day] [month] [year] [list]
Message-ID: <CAEf4BzayWEsojyZQsdWmtmaHXS88j8yLyxDV8VC13t5e-Or+kg@mail.gmail.com>
Date:   Mon, 29 Nov 2021 09:39:01 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Alan Maguire <alan.maguire@...cle.com>,
        Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        john fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf] libbpf: silence uninitialized warning/error in btf_dump_dump_type_data

On Mon, Nov 29, 2021 at 2:01 AM Alan Maguire <alan.maguire@...cle.com> wrote:
>
> When compiling libbpf with gcc 4.8.5, we see:
>
>   CC       staticobjs/btf_dump.o
> btf_dump.c: In function ‘btf_dump_dump_type_data.isra.24’:
> btf_dump.c:2296:5: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   if (err < 0)
>      ^
> cc1: all warnings being treated as errors
> make: *** [staticobjs/btf_dump.o] Error 1
>
> While gcc 4.8.5 is too old to build the upstream kernel, it's possible it
> could be used to build standalone libbpf which suffers from the same problem.
> Silence the error by initializing 'err' to 0.  The warning/error seems to be
> a false positive since err is set early in the function.  Regardless we
> shouldn't prevent libbpf from building for this.
>
> Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
>
> Signed-off-by: Alan Maguire <alan.maguire@...cle.com>
> ---

Arnaldo also complained about this.

Applied to bpf-next, I don't think it needs to be in the bpf tree. Thanks.


>  tools/lib/bpf/btf_dump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
> index 17db62b..5cae716 100644
> --- a/tools/lib/bpf/btf_dump.c
> +++ b/tools/lib/bpf/btf_dump.c
> @@ -2194,7 +2194,7 @@ static int btf_dump_dump_type_data(struct btf_dump *d,
>                                    __u8 bits_offset,
>                                    __u8 bit_sz)
>  {
> -       int size, err;
> +       int size, err = 0;
>
>         size = btf_dump_type_data_check_overflow(d, t, id, data, bits_offset);
>         if (size < 0)
> --
> 1.8.3.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ