Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1831145pxp; Mon, 21 Mar 2022 06:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGj0QeNkSzYMSRKHs9YW57DUc++CV/LWAgcxYfk0i598GBo6eNqE34ghT1843OQDHgiYJ0 X-Received: by 2002:aa7:de10:0:b0:419:430c:9b3d with SMTP id h16-20020aa7de10000000b00419430c9b3dmr4126708edv.366.1647868106806; Mon, 21 Mar 2022 06:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647868106; cv=none; d=google.com; s=arc-20160816; b=FzpnvH3DwE54QqQXctI9iNAf62e+usjIN7CXlEq/xxJ1IoCIDFNXbXaaNAy9GrRKjf kGnZd3f3ql3FbnFQ0h4asuUmdfLuCYUD+hKL3KcUVnGWOOJoRtytWhNLTRi4XMUYivx9 1jwr79bvTZ5VuOKdgtvll8qfB1HSCTelWlFdYEF2baaO37R0zXi1exB6I+oNpP4TTevJ P881Z3W0H4+urkYmt51+js0o7FkKO7cqIEjfiaRTSKsPTutICLZpqv+f00P4gTiFK2AM TQ8yPQmiIKUe7FTYa7AlSWqug0eBJIclBBgk/OR0SvsraDofm70QRg42UOgLyHEPvosX bmIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=B9Ak1aQXIT2+ZymL86Ds3xcpIx1nSxpG6N3HNh1513o=; b=vkqwy1TO7I4WvLk0Gi2GJGEDPWU3V/EugQ1PcGRwk9kC9lJehKVW5xNpBeU0SekLU2 FoDDsbI0E0rl9zT/OMo4c73Qo+kYBcqS0cfJut6RegMuA8FmlbJ+UTVRHFAEk+pewcAH NyLA7OLClyzE+gay3lACaM2x9Y+eK2IZewUXF4V4Tgr1vJgNkQrAMeV9cyMMQvAWLV9B ORt8JmVZ3M8H1ZUxpz42IZr2aVcGSJ/DwXrqjPzV/tiYNg75Z3NJ5AhRKWyGVy94Xlzd OWEstdgMNovvKGUWOF9NpppIDX66pi9tJMSCoU4kwUQT20NxqGIKckejFp+c3okr4fL0 qcbg== 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 f15-20020a1709063f4f00b006dfc33734absi7909861ejj.202.2022.03.21.06.07.59; Mon, 21 Mar 2022 06:08:26 -0700 (PDT) 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 S244505AbiCTAqC convert rfc822-to-8bit (ORCPT + 99 others); Sat, 19 Mar 2022 20:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244506AbiCTAqA (ORCPT ); Sat, 19 Mar 2022 20:46:00 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8388C25EC9B; Sat, 19 Mar 2022 17:44:34 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1nVjgL-0006H8-TO; Sun, 20 Mar 2022 01:44:30 +0100 Date: Sun, 20 Mar 2022 01:44:29 +0100 From: Florian Westphal To: Jakob Koschel Cc: Pablo Neira Ayuso , linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Mike Rapoport , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." Subject: Re: [PATCH] netfilter: nf_tables: replace unnecessary use of list_for_each_entry_continue() Message-ID: <20220320004429.GD13956@breakpoint.cc> References: <20220319202526.2527974-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20220319202526.2527974-1-jakobkoschel@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Jakob Koschel wrote: > Since there is no way for the previous list_for_each_entry() to exit > early, this call to list_for_each_entry_continue() is always guaranteed > to start with the first element of the list and can therefore be > replaced with a call to list_for_each_entry(). > > In preparation to limit the scope of the list iterator to the list > traversal loop, the list iterator variable 'rule' should not be used > past the loop. > > Signed-off-by: Jakob Koschel > > - list_for_each_entry_continue(rule, &chain->rules, list) { > + list_for_each_entry(rule, &chain->rules, list) { > if (!nft_is_active_next(net, rule)) > continue; You could also replace the first entry_continue and get rid of the preceeding rule = list_entry().