Skip to contentSkip to conversation

tipc: uninitialized return code in tipc_setsockopt()

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 24, 2017 – Jan 25, 2017

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

PATCH 1/1 tipc: uninitialized return code in tipc_setsockopt()

We shuffled some code around and added some new case statements here and now "res" isn't initialized on all paths.

Fixes 01fd12bb189a ("tipc: make replicast a user selectable option")
net/tipc/socket.c +1 -2
index 5bec8aac5008..103d1fd058c0 100644
@@ -2348,7 +2348,7 @@ static int tipc_setsockopt(struct socket *sock, int lvl, int opt,
 	struct sock *sk = sock->sk;
 	struct tipc_sock *tsk = tipc_sk(sk);
 	u32 value = 0;
-	int res;
+	int res = 0;
 
 	if ((lvl = IPPROTO_TCP) && (sock->type = SOCK_STREAM))
 		return 0;
@@ -2388,7 +2388,6 @@ static int tipc_setsockopt(struct socket *sock, int lvl, int opt,
 		break;
 	case TIPC_CONN_TIMEOUT:
 		tipc_sk(sk)->conn_timeout = value;
-		/* no need to set "res", since already 0 at this point */
 		break;
 	case TIPC_MCAST_BROADCAST:
 		tsk->mc_method.rcast = false;
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Tue, 24 Jan 2017 12:49:35 +0300

Quoted 5 lines

We shuffled some code around and added some new case statements here and now "res" isn't initialized on all paths.

Fixes 01fd12bb189a ("tipc: make replicast a user selectable option")

Applied, thanks Dan.