From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94A301F4174 for ; Thu, 4 Jun 2026 05:18:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780550305; cv=none; b=pipQTFv0JbscMFO6jHHz52xi3npXdoMnb0Va9pXIhnfQs7FOs9iLxnbWMFwQL3KMd9YOKxB4Q9b18eRvoIWk63VU0dbabwEn/7TpQyIxdt+oMWF6AvxOZwgXfAczcpvkJj9bFxM6es439PbJgaZ3f2ZeSjsXJolgDy0FEI4Rgw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780550305; c=relaxed/simple; bh=5zP8QkeIldQR8oeH0HhV4V/mXJJGJNin7wI2cdBzMBM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ULsXk3zx1w6JvUbW/XRj1VRdysmJRNnKGGwoTRAUT4qtH6Kr4sU92kwbStXewDKZjzaxZa+FZqOf3EaQLZPQbDSP8ZbGAjsYFs2+yBlmBLFbGl8Z2CsB1YyO2eP4f07o4ZWlitS6IixxCaHOfzCqiEP1QEMk1hSfr+9Q6FW/LOg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iunJUuOQ; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iunJUuOQ" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-36baec934b6so852688a91.0 for ; Wed, 03 Jun 2026 22:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780550302; x=1781155102; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RuBmEOIOOIyUhW5B0cAmum3h3GyphcqhgceqYCZrJ+8=; b=iunJUuOQRXa6b779on7nXnER/hfqzcp/G7oyBeW8FJs/CxyCWBOSUwwBrPhb0WUR8h FjDshLFVMHfLDcmfOGuWJ7q8kD4b5Crr9AcyA320pHezQfOux8DVtIoxYNUMqLi4G8sF P/J6m50KMqIv6XmtjoV95fqCM3RzBY7fAHH8ODxpRmAiB4HNvkImc1XEJU+dj4WMKWGK WpbL1PXpIIq2n1A7LbMeV97mmil1uMGc/Vo6clCQY3s2+Kr6nZXAewCTPrLA7MOdmh8u 3jFghhRV/2HX767mUq2uq2oO2hx66P3XDiLqrmA2qPeGRftjs2SWnD6aa67QI8byb0GP jC9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780550302; x=1781155102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RuBmEOIOOIyUhW5B0cAmum3h3GyphcqhgceqYCZrJ+8=; b=R/giTS92KOQiqRf038x0XPil5XJ1qoLCTVaCHDmxEDo9CnFk/+byYG7WCfSJGEAKW/ GzMFxZyvC2dLN4IQmkcOEC6TONJdUK/mOE5NcZrrYUY0kTJDsvOeAgOlO2IKtFQEvPVj uLFfIuzjZ+6/6eFOyGdQdUhLvOgjmii3wkCLxQndZBbpoXYlmShvtSeTvnGnqn9iYZ2g Gjm/W4/A9c4B91ILZXmMBan2UV4Tej+1wmUCc5i5bKDExAVb44sF8SXRwBglfLvh+HeK RXprUjySOHre/mtnZ76qx+wDa7gxXrhrwMii7jZSRXnl6fFojCBgxHN25Z6rVQxaip9n I2vA== X-Forwarded-Encrypted: i=1; AFNElJ+TfSOGntsdmo+0se9GkwgPkh7El1ahnd9nMg9lRRRw4gzp2p1mJIIyYOcNR5xHkwBXzrRRXRTx2TcmHUE=@vger.kernel.org X-Gm-Message-State: AOJu0YxWkygXbm5uyod9aB5F6Z88iCyeE+TzO7pr/nXuPsZt+5RF0Gyl VoXGyNNvKSFskLoJq0J2uO2zUhavkzT3x/ypbM+Zt5q0mDEmXlYHrF7c X-Gm-Gg: Acq92OGy7sOD0jqhECGzN7JvyJNMjJ6Ad6pAnjUa09kvxUM4LzB/4hSvqYEvPV8oKQ1 XD+YexewZEtp3t0yQncsiY83q3DWbTlhopbCPhrWanU7EbxWv6Tmg3ZYnKeo7dnwx7BhXFgJ66x R3BLON09Q4l3W5xa1JjTMCWRD0egIeeT2LtMawN7ywEvW+9FmgtlqM/aGfgEsIHK5IGmaQgCv/d O9rzBcRLKYpSYPFVhVtJXUI7QbcVX47lqUEOSjQ6xBXC/Fz0gfuySVuHTW8im6okeLXr3KS/uNe R/2Qbb0W6XI2Lt/IdeTeL0Du23YQ3RYtbeHOgNG+FX2YsXMGieaDTlMp+L1fyOqwRUyy5ILwLTg Of+QYxqx9M2g2ssb9ulnmH4lVcNG+Y93Ue+WFUvZJ8ONuJ2dtKdKX7NZN1qIImmtp/UBAA2FDtW /g4QU6YPR2Xc6BLjd7imwDA5P+cozF+mpgooUscAGP91jXZ57lwSMxYEpAMGY= X-Received: by 2002:a17:90b:1d82:b0:35f:c493:cac5 with SMTP id 98e67ed59e1d1-36f782b56b8mr1727051a91.16.1780550301842; Wed, 03 Jun 2026 22:18:21 -0700 (PDT) Received: from csl-conti-dell7858.ntu.edu.sg ([155.69.195.57]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36f6bf827e6sm2009262a91.1.2026.06.03.22.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 22:18:21 -0700 (PDT) From: Maoyi Xie To: joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, jpb@kernel.org Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, Maoyi Xie Subject: [PATCH 0/2] iommu: avoid using list iterators past the loop in resv region insertion Date: Thu, 4 Jun 2026 13:18:14 +0800 Message-Id: <20260604051816.2976221-1-maoyixie.tju@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This follows up the inquiry at [1], where Will and Robin agreed that the two list iterator sites in drivers/iommu/ that run past the loop end are worth fixing. Both loops only walk a list to find a list_head to insert before, not to operate on the entries. Per Robin's suggestion, rather than tracking an explicit insert_before pointer, each loop now iterates with list_for_each() and keeps the list_entry() dereference inside the loop body. There is no functional change in either patch. [1] https://lore.kernel.org/all/CAHPEe=G-FZvEXjkE+vAXN5MHXCtsOaUoKwg2RQL6m=om+c20hQ@mail.gmail.com/ Maoyi Xie (2): iommu: Avoid using the list iterator past the loop in iommu_insert_resv_region() iommu/virtio: Avoid using the list iterator past the loop in viommu_add_resv_mem() drivers/iommu/iommu.c | 7 +++++-- drivers/iommu/virtio-iommu.c | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731 -- 2.34.1