summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLi Qiong <liqiong@nfschina.com>2022-12-12 15:43:51 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2022-12-13 12:23:18 +0100
commitba57ee0944ff0085652cf8df91f9c571883debe6 (patch)
tree8c90bebf8be206426d080a7688cd31f45f4d7383 /net
parent5fb45f95eec682621748b7cb012c6a8f0f981e6a (diff)
downloadlwn-ba57ee0944ff0085652cf8df91f9c571883debe6.tar.gz
lwn-ba57ee0944ff0085652cf8df91f9c571883debe6.zip
ipvs: add a 'default' case in do_ip_vs_set_ctl()
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@nfschina.com> Reviewed-by: Simon Horman <horms@verge.net.au> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c5
1 files changed, 5 insertions, 0 deletions
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: