* [patch net-next] tipc: uninitialized return code in tipc_setsockopt()
@ 2017-01-24 9:49 Dan Carpenter
2017-01-25 17:41 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-01-24 9:49 UTC (permalink / raw)
To: Jon Maloy
Cc: Ying Xue, David S. Miller, netdev, tipc-discussion,
kernel-janitors
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 5bec8aac5008..103d1fd058c0 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch net-next] tipc: uninitialized return code in tipc_setsockopt()
2017-01-24 9:49 [patch net-next] tipc: uninitialized return code in tipc_setsockopt() Dan Carpenter
@ 2017-01-25 17:41 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-25 17:41 UTC (permalink / raw)
To: dan.carpenter
Cc: jon.maloy, ying.xue, netdev, tipc-discussion, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 24 Jan 2017 12:49:35 +0300
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks Dan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-25 17:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-24 9:49 [patch net-next] tipc: uninitialized return code in tipc_setsockopt() Dan Carpenter
2017-01-25 17:41 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).