[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 09/10] dom0less: Reinitialise all variables on each loop iteration


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Tue, 22 Jul 2025 13:59:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bc7Hsv3ngtfDZ1Ud/TSeBZjKVCTZPo3lEUHnZ4z78mA=; b=A2F9rBEgtO3Iws1vpv4D2MjPjMG+jPJMIyhnsJDV9oqHi6PGyPDfmId+md2NactQc0B6B98FL7DdM05lHiO9YGbrRl02X8kihXmtzHQVrLZvlC0YK2aPLRiz8YNDDsiyJDd+TSP8jJSdZfaqHU9S+g1WuvBA6c8CAdYHXdtxRuLnIgKtikgQpTA2vmhm/4Ygs3N4Fcw+DqcNTYIxbEAuWd8hloyYUKQ1X6jNltkm/eDSlE5lPKjSj+2ByT19Zl75a0dephk2Fu2lCTIIOKiw82AmtXRtCRd1zqe5OeRhg24AifX5L7+uE3d2XdfFscbVUpchqmWhke8bnqHqKEyNDA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pvij6Wz0sEdlZlUq6TI5Lo0zqyBLZqctoQvuzKD/3ofqKv2gs+OYnxP4Vz3N2QuMZ67ALnVv3xPjXHs7fC/w2cxfHQ2JTaLdTFTJXuSujlgmNn8QyfyskPkuNtZbHAE0s1vs9+6/Ce4/omBZagyD7u1I1AdRxOY6SV//HdQZF1HlYTbqj5S6Z5/9skcH8a8SlTXMSebGcGLfe1RRo/W+dEagQrjM7ji9QBB8ONlHjwUvvv2S0FrNGC7utvhMuprRXkTSTF/4nc8WL7AVMd6s8plEKsVHPBw4q9F5AQ41MaGPo6+jKvRljxQJsUmFOFtsiZgtFl2Tn/Yzn6tPFtA8Ew==
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Tue, 22 Jul 2025 12:00:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Reduce the scope of every variable so they are reinitialised. "iommu",
for instance, isn't being cleared, so the wrong flags may make it to
domains that should not have them.

Fixes: 1d2b4f3049fd("xen/arm, doc: Add a DT property to specify...")
Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
This is implicitly fixed in the next patch, but I'm sending this
standalone so it can be backported where relevant.
---
 xen/common/device-tree/dom0less-build.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/device-tree/dom0less-build.c 
b/xen/common/device-tree/dom0less-build.c
index ef4b095d97..676a3317cf 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -826,14 +826,14 @@ static int __init construct_domU(struct kernel_info 
*kinfo,
 void __init create_domUs(void)
 {
     struct dt_device_node *node;
-    const char *dom0less_iommu;
-    bool iommu = false;
-    const struct dt_device_node *cpupool_node,
-                                *chosen = dt_find_node_by_path("/chosen");
+    const struct dt_device_node *chosen = dt_find_node_by_path("/chosen");
 
     BUG_ON(chosen == NULL);
     dt_for_each_child_node(chosen, node)
     {
+        const char *dom0less_iommu;
+        bool iommu = false;
+        const struct dt_device_node *cpupool_node;
         struct kernel_info ki = KERNEL_INFO_INIT;
         struct xen_domctl_createdomain *d_cfg = &ki.bd.create_cfg;
         unsigned int *flags = &ki.bd.create_flags;
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.