LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH] ipvs: initialize 'ret' variable in do_ip_vs_set_ctl()

To: Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, "David S . Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>
Subject: [PATCH] ipvs: initialize 'ret' variable in do_ip_vs_set_ctl()
Cc: netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, kernel-janitors@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, Yu Zhe <yuzhe@xxxxxxxxxxxx>, Li Qiong <liqiong@xxxxxxxxxxxx>
From: Li Qiong <liqiong@xxxxxxxxxxxx>
Date: Fri, 2 Dec 2022 11:25:11 +0800
The 'ret' should need to be initialized to 0, in case
return a uninitialized value because no default process
for "switch (cmd)".

Signed-off-by: Li Qiong <liqiong@xxxxxxxxxxxx>
---
 net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 988222fff9f0..4b20db86077c 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -2456,7 +2456,7 @@ static int
 do_ip_vs_set_ctl(struct sock *sk, int cmd, sockptr_t ptr, unsigned int len)
 {
        struct net *net = sock_net(sk);
-       int ret;
+       int ret = 0;
        unsigned char arg[MAX_SET_ARGLEN];
        struct ip_vs_service_user *usvc_compat;
        struct ip_vs_service_user_kern usvc;
-- 
2.11.0


<Prev in Thread] Current Thread [Next in Thread>