Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e436456 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Daniel Borkmann
Browse files

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: e5cd3abc ("bpf: sockmap, refactor sockmap routines to work with hashmap")
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent eeacb716
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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_map_entry *e = NULL;
	struct smap_psock *psock;
	struct smap_psock *psock;
	bool new = false;
	bool new = false;
	int err;
	int err = 0;


	/* 1. If sock map has BPF programs those will be inherited by the
	/* 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
	 * sock being added. If the sock is already attached to BPF programs