Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6695974rwb; Mon, 5 Dec 2022 16:38:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Nnntj2x4aotJ8iMkzo8vSvWykq4qIhqGtXCrmgsWofqQ51K6eGlwDDPbkYVe/FGHRd4Bf X-Received: by 2002:a05:6402:d74:b0:46d:1a33:2197 with SMTP id ec52-20020a0564020d7400b0046d1a332197mr231128edb.282.1670287080672; Mon, 05 Dec 2022 16:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670287080; cv=none; d=google.com; s=arc-20160816; b=Hux4IPjBige3wejW7jWhPJkYTWB0jtCV2k5vMyckRpDzHLgBM/n6+EZYqSTG2o5iUW H1IxrKohcl37rboVJX+yU65yHgcQWRTwihPvIr/+gh1B3HbKytMf5+DNV2DK3bMgnI/o Vtu1zd+DPSOB5ULrZMwABNaiDCrU15OWqIBvT21mbTzis+23PAJlPjbtl3K/ufhEn63n OkL9YhRukUhZ+SEI4BiY4+nyHnHtfvcF6VO7+77POyW8N3x5UX1qFEP136IgI1v/EBCj Cl3kXT4XpFHZXUElgdW+t8zQ15CS4auG/j0yDMPh8qZK12rgA+Rr2cyg1DpHWlC8emmw pa4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=bzUJB4BIK4igBlgaKcA4jEfBn2Huv8KVgZak3cvZQS8=; b=WpgJTEkwjIJ+BjhRJFGkxoXcNmN/UFPZM3Hkl7gOGDD2l3jS4h6W1ylolPv4irRhED Nz6FKAjwoPCyTBSORc7MTjrR/glrLgZdmbgXIVR/CfkPUq8sU7A8xqLQM8tlUUxTX/xp fXP8KEBKo2rAWYPrVvUF2XSBnWDJq9wmydzCZTuDgwe83PvfjFaBP9jkiJcFcnAQKoOQ WRx0T3sOP4y98uSrRUJ6C0AaRWCAypi/KlI5YyedniTQ114IP4Mq5hvshZeeCD12QKYc 9hyzpawKgWs0q09nSIZ+uf8+2G30+9dNOVTfmLJEPkk+BYyNrEm9vrUQ81vUYV0RfP1r m0aQ== 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 z16-20020a1709063ad000b0078d38cda44bsi1563992ejd.694.2022.12.05.16.37.41; Mon, 05 Dec 2022 16:38:00 -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 S231735AbiLFA3S (ORCPT + 79 others); Mon, 5 Dec 2022 19:29:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiLFA3Q (ORCPT ); Mon, 5 Dec 2022 19:29:16 -0500 Received: from mail.nfschina.com (mail.nfschina.com [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 41BB8B3D; Mon, 5 Dec 2022 16:29:15 -0800 (PST) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 7E7321E80D57; Tue, 6 Dec 2022 08:24:58 +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 RWHGksHZdfdj; Tue, 6 Dec 2022 08:24:55 +0800 (CST) Received: from [172.30.38.124] (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 4FA151E80D0E; Tue, 6 Dec 2022 08:24:55 +0800 (CST) Subject: Re: [PATCH] netfilter: initialize 'ret' variable To: Pablo Neira Ayuso Cc: Jozsef Kadlecsik , Florian Westphal , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, kernel-janitors@vger.kernel.org, coreteam@netfilter.org, Yu Zhe References: <20221202070331.10865-1-liqiong@nfschina.com> From: liqiong Message-ID: <287de53c-78f1-94b5-6399-772e347057b5@nfschina.com> Date: Tue, 6 Dec 2022 08:29:09 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 在 2022年12月05日 22:26, Pablo Neira Ayuso 写道: > On Fri, Dec 02, 2022 at 03:03:31PM +0800, Li Qiong wrote: >> The 'ret' should need to be initialized to 0, in case >> return a uninitialized value. >> >> Signed-off-by: Li Qiong >> --- >> net/netfilter/nf_flow_table_ip.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c >> index b350fe9d00b0..225ff865d609 100644 >> --- a/net/netfilter/nf_flow_table_ip.c >> +++ b/net/netfilter/nf_flow_table_ip.c >> @@ -351,7 +351,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, >> struct rtable *rt; >> struct iphdr *iph; >> __be32 nexthop; >> - int ret; >> + int ret = 0; >> >> if (skb->protocol != htons(ETH_P_IP) && >> !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IP), &offset)) >> @@ -613,7 +613,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, >> u32 hdrsize, offset = 0; >> struct ipv6hdr *ip6h; >> struct rt6_info *rt; >> - int ret; >> + int ret = 0; >> >> if (skb->protocol != htons(ETH_P_IPV6) && >> !nf_flow_skb_encap_protocol(skb, htons(ETH_P_IPV6), &offset)) > This can only happen with tuplehash->tuple.xmit_type: > > - FLOW_OFFLOAD_XMIT_UNSPEC > - FLOW_OFFLOAD_XMIT_TC > > but this should not ever happen in that path. > > Instead, I'd suggest to add a 'default' case to the switch, set ret to > NF_DROP and WARN_ON_ONCE(1). Thanks, I will send a v2 patch.