Skip to content

Commit 0e43645

Browse files
GustavoARSilvaborkmann
authored andcommitted
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: e5cd3ab ("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>
1 parent eeacb71 commit 0e43645

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/bpf/sockmap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map,
17131713
struct smap_psock_map_entry *e = NULL;
17141714
struct smap_psock *psock;
17151715
bool new = false;
1716-
int err;
1716+
int err = 0;
17171717

17181718
/* 1. If sock map has BPF programs those will be inherited by the
17191719
* sock being added. If the sock is already attached to BPF programs

0 commit comments

Comments
 (0)