Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6333723rwb; Sun, 11 Dec 2022 23:51:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf6hVF56aj4tFc7ItoWwyOhPATfFUHBGgb8cmXBTSlAHNv6rY5Sn0dhu3+5qdsMaOx53EDZf X-Received: by 2002:a17:90a:9402:b0:219:84c:5a61 with SMTP id r2-20020a17090a940200b00219084c5a61mr15647762pjo.45.1670831502917; Sun, 11 Dec 2022 23:51:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670831502; cv=none; d=google.com; s=arc-20160816; b=XuJegxD5fL9nUAlAXyoi9Db06aIa1ce0ljU4v5Yrcwwp8kK9XczwfTdKKZIC2ENQAR tJpGbFLeqRrKXPjDBOaf56U1pkaBS+yuImKSF3cdT8s81ptUgzfx6AURcQT/0kaHmWC7 7ZVs8+5rNGb6HhrKQSHdHo0p/uFqPs3jb99Y45c/I1aNKJVll/LiLaqgswS8W57gq9KL R/0pGNWwKAKfeiUwB3thXkeTjD/GGjjRJqraKhJFx3yMIV435Cp/Q93rxkUy/ujpA8Z4 hesU6bqQwFdecBudFz6LKyXgzB0a6Z+My8j4XHICA/0tBl72+QRGzDWLb9ujvpZ6XZBq 4Myw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=qfgcBgHaL3S/EGKF63xrM3QPpE31x/0QK3yTRAmg9LM=; b=xc4/kbzZ9pBHoSE+0TIS8+VJkIenBpZx+m2zYCy5pszWXkz7yawUBjClY4kXyTz6F0 y3lyQnlV/QMD1DJbi8p1CWNHBc36CNgcGZIUSfrqiCuJnZ2LB+wG394Kh8to5KXdoIAh UYxwHKWWK7YkVqUFvkP2CmEHUxucvvL6i596KS5wil3i3Stl314DLY/tApkGUzfMk9My ZU20cbPiWHeYIu+la9szlSQP9Wb1retR6hKYZycpL+mJMAMSCfERhWZohqYBxHa59g4t I79mP3Di9yMOoJjM3vJTErTTpP0mAw/50s+wVNLSk+PpJRZ4HQK1+qHuVk9tBhsxt0oV g/Lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc8-20020a17090b3b8800b002190ba4112dsi9412177pjb.94.2022.12.11.23.51.33; Sun, 11 Dec 2022 23:51:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231404AbiLLHpB (ORCPT + 77 others); Mon, 12 Dec 2022 02:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiLLHo4 (ORCPT ); Mon, 12 Dec 2022 02:44:56 -0500 Received: from mail.nfschina.com (unknown [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2560CB84F; Sun, 11 Dec 2022 23:44:55 -0800 (PST) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id CA40F1E80D9B; Mon, 12 Dec 2022 15:40:18 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EtGpDXQytxlk; Mon, 12 Dec 2022 15:40:16 +0800 (CST) Received: from localhost.localdomain (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 48F101E80D9A; Mon, 12 Dec 2022 15:40:15 +0800 (CST) From: Li Qiong To: Simon Horman , Julian Anastasov , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, kernel-janitors@vger.kernel.org, coreteam@netfilter.org, Yu Zhe , Li Qiong Subject: [PATCH v2] ipvs: add a 'default' case in do_ip_vs_set_ctl() Date: Mon, 12 Dec 2022 15:43:51 +0800 Message-Id: <20221212074351.26440-1-liqiong@nfschina.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <272315c8-5e3b-e8ca-3c7f-68eccd0f2430@nfschina.com> References: <272315c8-5e3b-e8ca-3c7f-68eccd0f2430@nfschina.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Simon Horman --- 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