Skip to contentSkip to conversation

vxlan: fix possible use of uninitialized in vxlan_igmp_{join,leave}

PATCH Applied Marcelo Ricardo Leitner 2 participants 2 messages Mar 20, 2015

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

PATCH 1/1 vxlan: fix possible use of uninitialized in vxlan_igmp_{join,leave}

Test robot noticed that we check the return of vxlan_igmp_join and leave but inside them there was a path that it could be used initialized.

It's not really possible because those if() inside these igmp functions would always match as we can't have sockets of other type in there, but this way we keep the compiler happy.

Fixes 56ef9c909b40 ("vxlan: Move socket initialization to within rtnl scope")
---
 drivers/net/vxlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vxlan.c +2 -2
index 5f749a51f35624c3375ea536270faaf56c955e16..e75e4b2e6031578918e578a652a0ad6c578bade4 100644
@@ -1093,7 +1093,7 @@ static int vxlan_igmp_join(struct vxlan_dev *vxlan)
 	struct sock *sk = vs->sock->sk;
 	union vxlan_addr *ip = &vxlan->default_dst.remote_ip;
 	int ifindex = vxlan->default_dst.remote_ifindex;
-	int ret;
+	int ret = -EINVAL;
 
 	lock_sock(sk);
 	if (ip->sa.sa_family == AF_INET) {
@@ -1121,7 +1121,7 @@ static int vxlan_igmp_leave(struct vxlan_dev *vxlan)
 	struct sock *sk = vs->sock->sk;
 	union vxlan_addr *ip = &vxlan->default_dst.remote_ip;
 	int ifindex = vxlan->default_dst.remote_ifindex;
-	int ret;
+	int ret = -EINVAL;
 
 	lock_sock(sk);
 	if (ip->sa.sa_family == AF_INET) {
Signature · 1 line
2.1.0
maintainer Applied
#1 lore raw

From: Marcelo Ricardo Leitner <[email protected]>
Date: Fri, 20 Mar 2015 10:26:21 -0300

Quoted 10 lines

Test robot noticed that we check the return of vxlan_igmp_join and leave but inside them there was a path that it could be used initialized.

It's not really possible because those if() inside these igmp functions would always match as we can't have sockets of other type in there, but this way we keep the compiler happy.

Fixes 56ef9c909b40 ("vxlan: Move socket initialization to within rtnl scope")

Applied, thanks.