diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2018-05-17 16:08:43 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-05-17 22:44:43 +0200 |
commit | 0e4364560361d57e8cd873a8990327f3471d7d8a (patch) | |
tree | 75aa53c02f8f25eeab940f3e62ae5fb779bd8704 /kernel/bpf | |
parent | bpf: change eBPF helper doc parsing script to allow for smaller indent (diff) | |
download | linux-0e4364560361d57e8cd873a8990327f3471d7d8a.tar.xz linux-0e4364560361d57e8cd873a8990327f3471d7d8a.zip |
bpf: sockmap, fix uninitialized variable
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>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/sockmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index c6de1393df63..41b41fcc0466 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 |