Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2291352pxp; Mon, 21 Mar 2022 16:03:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6i9vhMgI+1qJSN2xKdeCCv+q163WMgF0b+iv/UYEAjWq93/fE2JSmIMGRKe2w2x/85f33 X-Received: by 2002:a17:90b:1809:b0:1c7:28fb:bdd0 with SMTP id lw9-20020a17090b180900b001c728fbbdd0mr1504618pjb.231.1647903831613; Mon, 21 Mar 2022 16:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647903831; cv=none; d=google.com; s=arc-20160816; b=dK/EZxchCMt8tli/Gj4jjiYRcz+6C3yLAJ8/KAz3Rf0UvcBHit2SM0JkLKZai69TVU 1XUuQp5mq9fFFGeq5e3mwrxQW5GDZ5Cp2CeYJOtN3KDiflFnaeIaYKR3ZWVMCDZPIC5g iLq/Fqadqm+9DKU6TJjPUAAY/5zIE6IbMgvvBi/jmzZr/EcmuYKNLKNFe4+rXZX7Lei6 aPMukYtmJTgYnrYJmX1KpnAvXjl4qqE6cNwp2yzhVNVHOBoBVVhji9YvIvEJYR2OL/Ka XpPGp1DFWeot5m+NRdMi8TFtGCrdTYoJbV704t9Ir1ahDpA8d9dYr8ISDnQDyjMwDORM nXsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UOoYNkWbn3lmrKEsG1YOHnatThAIgskfCdr/GMzc900=; b=c6HHnUMHvkE1bPLaiNhqdD930ppG5xELqzakhrcoos5UMke5TlvRgB7LADMuzEQBLk XOyUC2fdZO3PYPKRxqu2WrQFyE6d3nDRvGYIt2yttE6nuWIyEycKxxzdfMzeBfZESeul 76dl7buIYH57DkWKWIebv/Y0e8e/Qr4p+VZM1FnBwXT+lUvl/uAhNMUfu2IekECwdXZb nL5zCi51ne/MAoL1XeSx60A7jdiGhoys9rwdtSMvYpuPX0gjhldtgOjE1BJ0u0fMc9tl W4K8ykyF1uuH7cg1UeBJbZNRLCQV9EmOEqCluple8WnCZkWLHZoJTzBxrCcmpoWnral8 EpUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FMHp5b8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t143-20020a635f95000000b003816043efe8si12373168pgb.477.2022.03.21.16.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:03:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FMHp5b8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E8B3F31F330; Mon, 21 Mar 2022 15:02:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244135AbiCSU1M (ORCPT + 99 others); Sat, 19 Mar 2022 16:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244130AbiCSU1L (ORCPT ); Sat, 19 Mar 2022 16:27:11 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D0B835DFE; Sat, 19 Mar 2022 13:25:49 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id m12so13846997edc.12; Sat, 19 Mar 2022 13:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UOoYNkWbn3lmrKEsG1YOHnatThAIgskfCdr/GMzc900=; b=FMHp5b8Oreenx13Q81cuS53VAtjTKHzEOymx+hJeJ58vvMQW7Tzk/rbarGHHFANROV JEah+MBLJs9WIBok57cgluQ2hZ5Wae16wCUlihEYanNw96OZksh9xJxNfr86IPwPAzyc m4AczSJoEbiYsvGvgOWCf1YFCM6LancgKC72Ml5HlAmzBUatdOdtOSv61+tNSgLWbMbh 0hR//Yr6zP5p3d3ukoNa8TL6QJgHojMJQ2K8BOdLp+c0pq/nmodWvjAMEMapM65ztzqT 2NvPSNlkI9l73SxQ9FJ4DteCc9ftS4c2Sfh1a+GIm01q+F8lFogP1BvIZUPIsZBhv2Yo Z0rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UOoYNkWbn3lmrKEsG1YOHnatThAIgskfCdr/GMzc900=; b=UIEC2epbpHk/WE39sSGAwhhPXKxVTGJZ2VHgS4ajz7LQEmxndgYbtMZvQ7IDC2qpJ/ 6CL+Ya19DljD8iSJwVuAcoXQKbGiA6mFWaJMJmSUXBygyJhC4SAxF7S4nVAXvDd6fr5M 7Ck5VBQ+nMvhMYjhdyX+3w+o1Wr3ilepgsjGbK9ZpNhGEpflJGteC+7xQVa9gKNfC4DQ 2YiYQ/myuvEyKRZMUSSMFjVz+61SMyka/ZrfFET5nNaKlZf4PImamIC8Gj/fTjwbqWBJ UI6QRwY/Qum6x0TfsCrPqXb03pvPub/DFBxknsyTEmzklDJY9snnWNRdoDTP1xiwC2I5 IEeA== X-Gm-Message-State: AOAM530AZuH4YJtGupvzcZzlutItApnaIdQ3wQ9B+sEGvCy0jnwmJJ75 dkpmXxaLXFiaqKbIeDSWH98= X-Received: by 2002:a05:6402:3590:b0:415:c162:f3d6 with SMTP id y16-20020a056402359000b00415c162f3d6mr16023255edc.124.1647721547808; Sat, 19 Mar 2022 13:25:47 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id d23-20020aa7d5d7000000b00418f7b2f1dbsm4471945eds.71.2022.03.19.13.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Mar 2022 13:25:47 -0700 (PDT) From: Jakob Koschel To: Pablo Neira Ayuso Cc: Jakob Koschel , 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: [PATCH] netfilter: nf_tables: replace unnecessary use of list_for_each_entry_continue() Date: Sat, 19 Mar 2022 21:25:26 +0100 Message-Id: <20220319202526.2527974-1-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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 --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index d71a33ae39b3..bdd80136ef1d 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -8299,7 +8299,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha data_boundary = data + data_size; size = 0; - 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; base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601 -- 2.25.1