Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1768134rwb; Fri, 2 Dec 2022 00:26:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xJL5MAZYxdW68iboq/xSNVqRTOcm2NljhWnkq0H3ZPw4APS6gA+j87swIfmrX4XILO7gp X-Received: by 2002:a17:906:1641:b0:7ae:7d78:9fa1 with SMTP id n1-20020a170906164100b007ae7d789fa1mr58144131ejd.98.1669969574051; Fri, 02 Dec 2022 00:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669969574; cv=none; d=google.com; s=arc-20160816; b=nY3fjqg632R3dD4jfqGxEns+oFSFGA8hRes3FQ5E2XtXWu8gdJbtI5QgSmshe6se5b Js3mkdNlW1jKLv94nKTa0qUdJjIZvJdR+0cXfZ5RbEniYdqK8BWq7ghYORpQG9WOP6AC 8GnKWtrbNscGWbwIEZZDwuPRhIqQyvY/GyT5OQmqgDLa/ts8IgHu25qdvKaSpQbXimFU f2EqudrBQpcLdz0eeb0ImHV3zX8zokRqQUVgire/rYcfEM6PLRTbVSjTUsOkS9Tqncag 3/ErawOJ+1BU6XpDol/ddDdrxbAMnlsUFQJVCob4FfWc0QH2p/kT7UKZ6yoNoX0nTe+c rk9Q== 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=pxbbra0mhYIM5H4Ff+kdKAC8MqEEtN/rtsoyGWVcl2U=; b=xwUgHYJsjE2PcHkKkBM3nErHV0tCeUyLZfRGRLhpi13mLfk2pk1uUbbnaU+1Y2+Ynv TH/E/St+fPUNdzZbuxT2XtPTY2iwDCuO8ByLkzGgAgattxH7lxzbcvJVKF1CbErOJH/a Nl7RB3RMfHDkg2u9j5+8iaY4lMbds9O3mWOkVO/wo29ttN/hD70Sia8a3WexjE1G6/Wn UtsO6QHBRMzkXB5Seqr4EfWuURjXidcC4bypNhS6sd9CitxZLxp78z+2JaaOBLVM4fmB rROMSG0NcWOsC+EbuvkSCgPAS59NT1abDu+oyRqCQ/PXxM8tRWayOGyfPZ/5IwRqVsAx MzPQ== 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 f18-20020a0564021e9200b0046b5f810167si6367507edf.279.2022.12.02.00.25.53; Fri, 02 Dec 2022 00:26:14 -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 S232570AbiLBIGw (ORCPT + 82 others); Fri, 2 Dec 2022 03:06:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232075AbiLBIGt (ORCPT ); Fri, 2 Dec 2022 03:06:49 -0500 Received: from mail.nfschina.com (unknown [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E8B8D2B184; Fri, 2 Dec 2022 00:06:47 -0800 (PST) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 207C71E80D27; Fri, 2 Dec 2022 16:02:43 +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 DhQTXNaVJn90; Fri, 2 Dec 2022 16:02:40 +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 EE53C1E80CCF; Fri, 2 Dec 2022 16:02:39 +0800 (CST) Subject: Re: [PATCH] netfilter: initialize 'ret' variable To: Al Viro Cc: Pablo Neira Ayuso , 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: <533ef392-5b77-9939-a961-872467d49cc3@nfschina.com> Date: Fri, 2 Dec 2022 16:06:43 +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: 7bit 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 > 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. > Why is 0 the right value? And which case would it be? > We clearly need to know that to figure out which return > value would be correct for it... Hi, here is a case: for (i = 0; i < e->num_hook_entries; i++) { ret = e->hooks[i].hook(e->hooks[i].priv, skb, state); if (ret != NF_ACCEPT) return ret; .... } I am not sure if 0 (NF_DROP) is the best value, but It's better to initialize a value.