[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yuf+Y7ocn1mgiaE3@krava>
Date: Mon, 1 Aug 2022 18:25:07 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: bpf@...r.kernel.org, Andrii Nakryiko <andrii@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>,
Dave Marchevsky <davemarchevsky@...com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] libbpf: Initialize err in probe_map_create
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@...il.com>
Acked-by: Jiri Olsa <jolsa@...nel.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
>
Powered by blists - more mailing lists