Re: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr
From: Greg KH <gregkh@linuxfoundation.org>
Date: 2022-02-28 11:20:15
Also in:
alsa-devel, amd-gfx, dmaengine, dri-devel, intel-gfx, intel-wired-lan, kvm, linux-arch, linux-aspeed, linux-block, linux-cifs, linux-crypto, linux-f2fs-devel, linux-fsdevel, linux-iio, linux-media, linux-mediatek, linux-pm, linux-rdma, linux-scsi, linux-staging, linux-tegra, linux-usb, linux-wireless, lkml, netdev, nouveau
On Mon, Feb 28, 2022 at 12:08:18PM +0100, Jakob Koschel wrote:
If the list does not contain the expected element, the value of
list_for_each_entry() iterator will not point to a valid structure.
To avoid type confusion in such case, the list iterator
scope will be limited to list_for_each_entry() loop.
In preparation to limiting scope of a list iterator to the list traversal
loop, use a dedicated pointer to point to the found element.
Determining if an element was found is then simply checking if
the pointer is != NULL.
Signed-off-by: Jakob Koschel <redacted>
---
arch/x86/kernel/cpu/sgx/encl.c | 6 +++--
drivers/scsi/scsi_transport_sas.c | 17 ++++++++-----
drivers/thermal/thermal_core.c | 38 ++++++++++++++++++----------
drivers/usb/gadget/configfs.c | 22 ++++++++++------
drivers/usb/gadget/udc/max3420_udc.c | 11 +++++---
drivers/usb/gadget/udc/tegra-xudc.c | 11 +++++---
drivers/usb/mtu3/mtu3_gadget.c | 11 +++++---
drivers/usb/musb/musb_gadget.c | 11 +++++---
drivers/vfio/mdev/mdev_core.c | 11 +++++---
9 files changed, 88 insertions(+), 50 deletions(-)
The drivers/usb/ portion of this patch should be in patch 1/X, right?
Also, you will have to split these up per-subsystem so that the
different subsystem maintainers can take these in their trees.
thanks,
greg k-h