[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQLohzfYs7RLFt09aG6QqC8HVO2CgzJ08jyoUybJt10bDg@mail.gmail.com>
Date: Thu, 6 Aug 2020 16:48:04 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: "Daniel T. Lee" <danieltimlee@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andriin@...com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf-next] libbf: fix uninitialized pointer at btf__parse_raw()
On Wed, Aug 5, 2020 at 11:22 PM John Fastabend <john.fastabend@...il.com> wrote:
>
> Daniel T. Lee wrote:
> > Recently, from commit 94a1fedd63ed ("libbpf: Add btf__parse_raw() and
> > generic btf__parse() APIs"), new API has been added to libbpf that
> > allows to parse BTF from raw data file (btf__parse_raw()).
> >
> > The commit derives build failure of samples/bpf due to improper access
> > of uninitialized pointer at btf_parse_raw().
> >
> > btf.c: In function btf__parse_raw:
> > btf.c:625:28: error: btf may be used uninitialized in this function
> > 625 | return err ? ERR_PTR(err) : btf;
> > | ~~~~~~~~~~~~~~~~~~~^~~~~
> >
> > This commit fixes the build failure of samples/bpf by adding code of
> > initializing btf pointer as NULL.
> >
> > Fixes: 94a1fedd63ed ("libbpf: Add btf__parse_raw() and generic btf__parse() APIs")
> > Signed-off-by: Daniel T. Lee <danieltimlee@...il.com>
> > ---
>
> Unless errno is zero this should be ok in practice, but I guess compiler
> wont know that.
>
> Acked-by: John Fastabend <john.fastabend@...il.com>
Applied. Thanks
Powered by blists - more mailing lists