LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH 1/2] bpf: sockmap, fix uninitialized variable
Date: Thu, 17 May 2018 09:08:43 -0500 [thread overview]
Message-ID: <11073635016901e9e84c2f34f20d412073b26297.1526565461.git.gustavo@embeddedor.com> (raw)
In-Reply-To: <cover.1526565461.git.gustavo@embeddedor.com>
There is a potential execution path in which variable err is
returned without being properly initialized previously.
Fix this by initializing variable err to 0.
Addresses-Coverity-ID: 1468964 ("Uninitialized scalar variable")
Fixes: e5cd3abcb31a ("bpf: sockmap, refactor sockmap routines to work
with hashmap")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
kernel/bpf/sockmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index c6de139..41b41fc 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -1713,7 +1713,7 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map,
struct smap_psock_map_entry *e = NULL;
struct smap_psock *psock;
bool new = false;
- int err;
+ int err = 0;
/* 1. If sock map has BPF programs those will be inherited by the
* sock being added. If the sock is already attached to BPF programs
--
2.7.4
next prev parent reply other threads:[~2018-05-17 14:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 14:04 [PATCH 0/2] bpf: sockmap, fix uninitialized variable and double-free Gustavo A. R. Silva
2018-05-17 14:08 ` Gustavo A. R. Silva [this message]
2018-05-17 17:27 ` [PATCH 1/2] bpf: sockmap, fix uninitialized variable John Fastabend
2018-05-17 18:12 ` Gustavo A. R. Silva
2018-05-17 14:11 ` [PATCH 2/2] bpf: sockmap, fix double-free Gustavo A. R. Silva
2018-05-17 17:26 ` John Fastabend
2018-05-17 20:51 ` [PATCH 0/2] bpf: sockmap, fix uninitialized variable and double-free Daniel Borkmann
2018-05-17 20:53 ` Gustavo A. R. Silva
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=11073635016901e9e84c2f34f20d412073b26297.1526565461.git.gustavo@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--subject='Re: [PATCH 1/2] bpf: sockmap, fix uninitialized variable' \
/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
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).