Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6780508rwb; Mon, 12 Dec 2022 06:23:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4bpMU7+IohTFsTuRmL3p7njx8YW2Xq1Pv02XZHoCKq7ROIH4pWmDz8MOuOxHHuFAgbEFoz X-Received: by 2002:a05:6a20:1588:b0:9d:efbf:7877 with SMTP id h8-20020a056a20158800b0009defbf7877mr25981828pzj.44.1670855007470; Mon, 12 Dec 2022 06:23:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670855007; cv=none; d=google.com; s=arc-20160816; b=HgywEQYXDq0+l1uZ/6C9nrF3HiYOBxlLH8YLFA1oWJKcBKUnEnKCUSFMg1+WG3DmUm 5L4Llvt4tJ1Ss2GQARGxAoPlA0h23st8/rtk0FDUzVxNNcRCf+wupJjF0Ob+7NZAuCfZ Lp2TlvdlxS/vIZlf9m6K/Izt0S46m9iHMmltJl/LxNfH7mMq0N2JA6acpPPzdoJHbV94 fpRRstggZzNX8sfh0ZDwUySkVTgWPyNCwfBAX4NBWXNJdrH6koa/SyLfOa2+qDQQkfsa /o5BusDtPzalRh6POly4fDviOihk97sie4la+2FzQ0TwxqIyYgNZUupmZOeo4bSNp4Pl Gtvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=8vh14e6RPp4PMEsnNIAOyjWEJrBY9gtjpqhnDNd3H/I=; b=QT1HVVd5Dw+0lxOE724n7VqfubAc/KvnvH23z5uzsQ7dqU97o7LvZtlhwNnB4XW2Up PV7ooQ32m+ygWDHdvUnKWNopSG3gCxOiII2gYpI3h5WNBUft7qGXUbm6ibW3sfizCbzj Bm8NNdO7WHE/8NoGM3KVeJ4IP7uXH96r59kLacaIAkpzx/93Iz5lxX/qrpSAgtx2tGvM MmBEt0u4WdWfR7VhcuN4hvjhC4jGRm4eeYwh0+dumcDrHQpRL1JCRv0MWoDG4CImETfs MeBzSNlMtugKssmL1BcyCcmwea4Bo78alL363DcNWld8rYFjjPQx0fSV05Ss3FyEKhyN DsHg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ssi.bg Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a170902db0800b00186a3bc939esi10496905plx.211.2022.12.12.06.23.17; Mon, 12 Dec 2022 06:23:27 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ssi.bg Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231725AbiLLOVA (ORCPT + 75 others); Mon, 12 Dec 2022 09:21:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbiLLOU6 (ORCPT ); Mon, 12 Dec 2022 09:20:58 -0500 Received: from mg.ssi.bg (mg.ssi.bg [193.238.174.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C194B7644; Mon, 12 Dec 2022 06:20:56 -0800 (PST) Received: from mg.ssi.bg (localhost [127.0.0.1]) by mg.ssi.bg (Proxmox) with ESMTP id 8D97142D42; Mon, 12 Dec 2022 16:20:55 +0200 (EET) Received: from ink.ssi.bg (unknown [193.238.174.40]) by mg.ssi.bg (Proxmox) with ESMTP id 13CCA42DDC; Mon, 12 Dec 2022 16:20:51 +0200 (EET) Received: from ja.ssi.bg (unknown [178.16.129.10]) by ink.ssi.bg (Postfix) with ESMTPS id 536733C07CB; Mon, 12 Dec 2022 16:20:46 +0200 (EET) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by ja.ssi.bg (8.17.1/8.16.1) with ESMTP id 2BCEKf1E041625; Mon, 12 Dec 2022 16:20:44 +0200 Date: Mon, 12 Dec 2022 16:20:41 +0200 (EET) From: Julian Anastasov To: Li Qiong cc: Simon Horman , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netdev@vger.kernel.org, linux-kernel , lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, kernel-janitors@vger.kernel.org, coreteam@netfilter.org, Yu Zhe Subject: Re: [PATCH v2] ipvs: add a 'default' case in do_ip_vs_set_ctl() In-Reply-To: <20221212074351.26440-1-liqiong@nfschina.com> Message-ID: References: <272315c8-5e3b-e8ca-3c7f-68eccd0f2430@nfschina.com> <20221212074351.26440-1-liqiong@nfschina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 Hello, On Mon, 12 Dec 2022, Li Qiong wrote: > 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 Change looks correct to me for -next, thanks! Acked-by: Julian Anastasov Still, the comment can explain that this code is currently unreachable and that some parsers need the default case to avoid report for uninitialized 'ret'. > --- > 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 Regards -- Julian Anastasov