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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37CB5C46467 for ; Tue, 1 Mar 2022 17:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236754AbiCARlc (ORCPT ); Tue, 1 Mar 2022 12:41:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236689AbiCARlS (ORCPT ); Tue, 1 Mar 2022 12:41:18 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A557A3FD9A; Tue, 1 Mar 2022 09:40:08 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id qk11so33047112ejb.2; Tue, 01 Mar 2022 09:40:08 -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=7BjOqnZ5sU9qNZ+ZbtSmgnT5ugUg93W5EXL23Z5fe91YD2NAMRFaHW96/iox28ODCe zqAFwD48zzIEd81R9GJv5UK+KG9scXt7NvQtyP+Tf5kF63AzEx5N9z8DCwxFBhh7olol j+i7AEIN6OT5RB2ty/uoXl9LTeWga37qhGhumANM9x1vRakL08DEGpxWyxOzWbkagvl5 hx2G33gWBsH3/S06EqJo0yi12GOrr5OLeiJxLIPeZrW7pPUk4+hc//wyXdd6sazAO3nv Dav3+r8ijXUxQvrfHbHDAATDTCs2mESdLmjJW2dmuOW4FcQVPcuapDoh+166AMkBBZwv oVhA== X-Gm-Message-State: AOAM530VelPFZGzmt8PzE4qZ+PeqHB0a4Jg3ubfAK0hD+zaASk4je+GF jsmkzHlrJhshQu1Koj+2bw0= 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 Cc: Linus Torvalds , =?utf-8?Q?Christian_K=C3=B6nig?= , alsa-devel@alsa-project.org, linux-aspeed@lists.ozlabs.org, "Gustavo A. R. Silva" , linux-iio@vger.kernel.org, nouveau@lists.freedesktop.org, Rasmus Villemoes , dri-devel , Cristiano Giuffrida , amd-gfx list , samba-technical@lists.samba.org, linux1394-devel@lists.sourceforge.net, drbd-dev@lists.linbit.com, linux-arch , CIFS , KVM list , 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 , Brian Johannesmeyer , Nathan Chancellor , linux-fsdevel , 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, linux-wireless , Linux Kernel Mailing List , Linux F2FS Dev Mailing List , tipc-discussion@lists.sourceforge.net, Linux Crypto Mailing List , dma , linux-mediatek@lists.infradead.org, Andrew Morton , linuxppc-dev , Mike Rapoport 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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=