Skip to content

Commit

Permalink
tipc: uninitialized return code in tipc_setsockopt()
Browse files Browse the repository at this point in the history
We shuffled some code around and added some new case statements here and
now "res" isn't initialized on all paths.

Fixes: 01fd12b ("tipc: make replicast a user selectable option")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Dan Carpenter authored and davem330 committed Jan 25, 2017
1 parent 1045ba7 commit a08ef47
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a08ef47

Please sign in to comment.