From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFA17C433F5 for ; Tue, 1 Mar 2022 17:40:52 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K7Pfp1y70z3by0 for ; Wed, 2 Mar 2022 04:40:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=jNa8kCMt; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::62e; helo=mail-ej1-x62e.google.com; envelope-from=jakobkoschel@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=jNa8kCMt; dkim-atps=neutral Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4K7Pf45zgkz2yb5; Wed, 2 Mar 2022 04:40:11 +1100 (AEDT) Received: by mail-ej1-x62e.google.com with SMTP id qa43so6428403ejc.12; Tue, 01 Mar 2022 09:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pFdYiycpncfTymiwtZowrsS5EyWiXpYxNs42/BHAfYg=; b=jNa8kCMtl/UUGI9n6DMpRCjqu31f4wAijdvFFxZnjTmTKVAPvZHGvGIS5mEbyeVH7U 2x/09r6Vjc5jlvMmGEJ/il9wQB7v0QaDJcbwnO54cttgXGRrRpdgplSbMXJLSVGPucZZ 9N0BbQ67CEO0Sz9E19ATZ7SkTLFNHyfaTEafdxDnprAieU2S7WSxP1eMUqDcJyOgT3om KiVwLoBVmeYUr/3jVH1Ywgf3KLmBchJpZXF9NW4w0E+aOTUpi5SfsW8FSQSkfcXvzSp5 ZeMWPQFNXAG0u+f0IIKFL+VZxclmrwVLcWvb/ml3Qc/gpz+jEOgbpY53v+25m0fIUJKc BDYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pFdYiycpncfTymiwtZowrsS5EyWiXpYxNs42/BHAfYg=; b=ztCPbW6vRindqJblnYh88MFi0mwI/a+Ia9K/r3A1+lIpa6eWycKGojv0CIbSocylVM /fOJ2qrosH0cKg9ci+ZnRxjdoLoqI9dWPo6OcE7gBNNVGoJP6N4Jhf7CEPAwcW7Ax6Y2 aV/MslanZuucihKmvrEeVdX3J1D/hH+miSlOeFbvJSM3KvR8W6ctwQYDndImt00YB1j+ WVF/dQf/jEIeVDuVtjchcMewfhzLNl9f3Hu9orNwAWwqi3xhb8wzuVr7migDPfM1DddX C4n4bbBeQiE88tCDHNB3Oczbos2VHeCmxfdcL+wRWe3URt/x88ndd7povCad2fXL1TJW iPPw== X-Gm-Message-State: AOAM530TsAY0nx2c3qPGYpExwM7iCm7jgAWwXQvRyXF/YDKxuiZoLZmQ 4FDp9TuByjxcJS2XxNwWAi8= X-Google-Smtp-Source: ABdhPJwzanGhehpmLWEMTTJkMBhYufoyhmHURG9yND716ZZIbM/kd8Ex5thBnsVmcSvoj9ZPyJ3fsw== X-Received: by 2002:a17:906:948:b0:6d6:e479:1fe4 with SMTP id j8-20020a170906094800b006d6e4791fe4mr3312230ejd.240.1646156406993; Tue, 01 Mar 2022 09:40:06 -0800 (PST) Received: from smtpclient.apple ([2a02:8109:9d80:3f6c:6db3:8d4c:747e:98ad]) by smtp.gmail.com with ESMTPSA id a25-20020a50ff19000000b0040f84cd806csm7398100edu.59.2022.03.01.09.40.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Mar 2022 09:40:06 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr From: Jakob Koschel In-Reply-To: Date: Tue, 1 Mar 2022 18:40:04 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <4B1AFAD9-C1B3-499C-945A-C259361ABA8C@gmail.com> References: <20220228110822.491923-1-jakobkoschel@gmail.com> <20220228110822.491923-3-jakobkoschel@gmail.com> <2e4e95d6-f6c9-a188-e1cd-b1eae465562a@amd.com> To: Greg KH X-Mailer: Apple Mail (2.3693.60.0.1.1) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless , alsa-devel@alsa-project.org, KVM list , "Gustavo A. R. Silva" , linux-iio@vger.kernel.org, nouveau@lists.freedesktop.org, Rasmus Villemoes , dri-devel , Cristiano Giuffrida , amd-gfx list , linux1394-devel@lists.sourceforge.net, drbd-dev@lists.linbit.com, linux-arch , CIFS , linux-aspeed@lists.ozlabs.org, linux-scsi , linux-rdma , linux-staging@lists.linux.dev, "Bos, H.J." , Jason Gunthorpe , intel-wired-lan@lists.osuosl.org, kgdb-bugreport@lists.sourceforge.net, bcm-kernel-feedback-list@broadcom.com, Dan Carpenter , Linux Media Mailing List , Kees Cook , Arnd Bergman , Linux PM , intel-gfx , linuxppc-dev , Brian Johannesmeyer , Nathan Chancellor , dma , Christophe JAILLET , v9fs-developer@lists.sourceforge.net, linux-tegra , Thomas Gleixner , Andy Shevchenko , Linux ARM , linux-sgx@vger.kernel.org, linux-block , Netdev , linux-usb@vger.kernel.org, samba-technical@lists.samba.org, Linux Kernel Mailing List , Linux F2FS Dev Mailing List , tipc-discussion@lists.sourceforge.net, Linux Crypto Mailing List , linux-fsdevel , linux-mediatek@lists.infradead.org, Andrew Morton , Linus Torvalds , =?utf-8?Q?Christian_K=C3=B6nig?= , Mike Rapoport Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" > On 1. Mar 2022, at 18:36, Greg KH wrote: >=20 > On Tue, Mar 01, 2022 at 12:28:15PM +0100, Jakob Koschel wrote: >>=20 >>=20 >>> On 1. Mar 2022, at 01:41, Linus Torvalds = wrote: >>>=20 >>> On Mon, Feb 28, 2022 at 1:47 PM Jakob Koschel = wrote: >>>>=20 >>>> The goal of this is to get compiler warnings right? This would = indeed be great. >>>=20 >>> Yes, so I don't mind having a one-time patch that has been gathered >>> using some automated checker tool, but I don't think that works from = a >>> long-term maintenance perspective. >>>=20 >>> So if we have the basic rule being "don't use the loop iterator = after >>> the loop has finished, because it can cause all kinds of subtle >>> issues", then in _addition_ to fixing the existing code paths that >>> have this issue, I really would want to (a) get a compiler warning = for >>> future cases and (b) make it not actually _work_ for future cases. >>>=20 >>> Because otherwise it will just happen again. >>>=20 >>>> Changing the list_for_each_entry() macro first will break all of = those cases >>>> (e.g. the ones using 'list_entry_is_head()). >>>=20 >>> So I have no problems with breaking cases that we basically already >>> have a patch for due to your automated tool. There were certainly >>> more than a handful, but it didn't look _too_ bad to just make the >>> rule be "don't use the iterator after the loop". >>>=20 >>> Of course, that's just based on that patch of yours. Maybe there are = a >>> ton of other cases that your patch didn't change, because they = didn't >>> match your trigger case, so I may just be overly optimistic here. >>=20 >> Based on the coccinelle script there are ~480 cases that need fixing >> in total. I'll now finish all of them and then split them by >> submodules as Greg suggested and repost a patch set per submodule. >> Sounds good? >=20 > Sounds good to me! >=20 > If you need help carving these up and maintaining them over time as > different subsystem maintainers accept/ignore them, just let me know. > Doing large patchsets like this can be tough without a lot of > experience. Very much appreciated! There will probably be some cases that do not match one of the pattern we already discussed and need separate attention. I was planning to start with one subsystem and adjust the coming ones according to the feedback gather there instead of posting all of them in one go. >=20 > thanks, >=20 > greg k-h - Jakob=