netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: "Daniel T. Lee" <danieltimlee@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andriin@fb.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: RE: [PATCH bpf-next] libbf: fix uninitialized pointer at btf__parse_raw()
Date: Wed, 05 Aug 2020 23:21:40 -0700	[thread overview]
Message-ID: <5f2ba174c65a7_291f2b27e574e5b81@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20200805223359.32109-1-danieltimlee@gmail.com>

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@gmail.com>
> ---

Unless errno is zero this should be ok in practice, but I guess compiler
wont know that.

Acked-by: John Fastabend <john.fastabend@gmail.com>

  reply	other threads:[~2020-08-06 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 22:33 [PATCH bpf-next] libbf: fix uninitialized pointer at btf__parse_raw() Daniel T. Lee
2020-08-06  6:21 ` John Fastabend [this message]
2020-08-06 23:48   ` Alexei Starovoitov

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=5f2ba174c65a7_291f2b27e574e5b81@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=danieltimlee@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).