From: Jiri Olsa <olsajiri@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: bpf@vger.kernel.org, Andrii Nakryiko <andrii@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Dave Marchevsky <davemarchevsky@fb.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] libbpf: Initialize err in probe_map_create
Date: Mon, 1 Aug 2022 18:25:07 +0200 [thread overview]
Message-ID: <Yuf+Y7ocn1mgiaE3@krava> (raw)
In-Reply-To: <20220801025109.1206633-1-f.fainelli@gmail.com>
On Sun, Jul 31, 2022 at 07:51:09PM -0700, Florian Fainelli wrote:
> GCC-11 warns about the possibly unitialized err variable in
> probe_map_create:
>
> libbpf_probes.c: In function 'probe_map_create':
> libbpf_probes.c:361:38: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 361 | return fd < 0 && err == exp_err ? 1 : 0;
> | ~~~~^~~~~~~~~~
>
> Fixes: 878d8def0603 ("libbpf: Rework feature-probing APIs")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
> ---
> tools/lib/bpf/libbpf_probes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
> index 97b06cede56f..6cf44e61815d 100644
> --- a/tools/lib/bpf/libbpf_probes.c
> +++ b/tools/lib/bpf/libbpf_probes.c
> @@ -247,7 +247,7 @@ static int probe_map_create(enum bpf_map_type map_type, __u32 ifindex)
> LIBBPF_OPTS(bpf_map_create_opts, opts);
> int key_size, value_size, max_entries;
> __u32 btf_key_type_id = 0, btf_value_type_id = 0;
> - int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err;
> + int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err = 0;
>
> opts.map_ifindex = ifindex;
>
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-08-01 16:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 2:51 [PATCH] libbpf: Initialize err in probe_map_create Florian Fainelli
2022-08-01 16:25 ` Jiri Olsa [this message]
2022-08-04 21:50 ` patchwork-bot+netdevbpf
2022-08-31 21:50 ` Florian Fainelli
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=Yuf+Y7ocn1mgiaE3@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davemarchevsky@fb.com \
--cc=f.fainelli@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.com \
/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