lvs-devel
|
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 v2] ipvs: add a 'default' case 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: | Mon, 12 Dec 2022 15:43:51 +0800 |
It is better to return the default switch case with '-EINVAL', in case new commands are added. otherwise, return a uninitialized value of ret. Signed-off-by: Li Qiong <liqiong@xxxxxxxxxxxx> Reviewed-by: Simon Horman <horms@xxxxxxxxxxxx> --- v2: Add 'default' case instead of initializing 'ret'. --- net/netfilter/ipvs/ip_vs_ctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 988222fff9f0..97f6a1c8933a 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -2590,6 +2590,11 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, sockptr_t ptr, unsigned int len) break; case IP_VS_SO_SET_DELDEST: ret = ip_vs_del_dest(svc, &udest); + break; + default: + WARN_ON_ONCE(1); + ret = -EINVAL; + break; } out_unlock: -- 2.11.0 |
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | Re: [PATCH] ipvs: initialize 'ret' variable in do_ip_vs_set_ctl(), liqiong |
---|---|
Next by Date: | Re: [PATCH v2] ipvs: add a 'default' case in do_ip_vs_set_ctl(), Julian Anastasov |
Previous by Thread: | Re: [PATCH] ipvs: initialize 'ret' variable in do_ip_vs_set_ctl(), liqiong |
Next by Thread: | Re: [PATCH v2] ipvs: add a 'default' case in do_ip_vs_set_ctl(), Julian Anastasov |
Indexes: | [Date] [Thread] [Top] [All Lists] |