Skip to contentSkip to conversation

bpf: sockmap, potential uninitialized return in __sock_map_ctx_update_elem()

PATCH In review Dan Carpenter 1 participant 1 message May 18, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 bpf: sockmap, potential uninitialized return in __sock_map_ctx_update_elem()

Smatch complains that "err" might be uninitialized. That seems possible. Anyway we can just return zero.

Fixes e5cd3abcb31a ("bpf: sockmap, refactor sockmap routines to work with hashmap")
kernel/bpf/sockmap.c +1 -1
index c6de1393df63..6298adb3162a 100644
@@ -1821,7 +1821,7 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map,
 		list_add_tail(&e->list, &psock->maps);
 	}
 	write_unlock_bh(&sock->sk_callback_lock);
-	return err;
+	return 0;
 out_free:
 	kfree(e);
 	smap_release_sock(psock, sock);