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

[PATCH] xen/dt: Only parse direct child nodes of /reserved-memory



process_reserved_memory() uses device_tree_for_each_node(), which walks
all descendants of /reserved-memory rather than just its direct children.
However, a child node such as nvmem-rmem can contain nvmem-layout and
cell subnodes whose reg properties specify internal offsets rather than
physical memory addresses. Parsing these subnodes records invalid
reserved memory regions and fails the overlap check when bitfield cells
share the same offset.

Ignore nodes with depth != 1 in process_reserved_memory_node().

Fixes: d96594eef39a ("xen/arm: keep track of reserved-memory regions")
Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
---
 xen/common/device-tree/bootinfo-fdt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/common/device-tree/bootinfo-fdt.c 
b/xen/common/device-tree/bootinfo-fdt.c
index ca64daf4cd..eea35325f7 100644
--- a/xen/common/device-tree/bootinfo-fdt.c
+++ b/xen/common/device-tree/bootinfo-fdt.c
@@ -185,8 +185,13 @@ static int __init process_reserved_memory_node(const void 
*fdt, int node,
                                                u32 size_cells,
                                                void *data)
 {
-    int rc = process_memory_node(fdt, node, name, depth, address_cells,
-                                 size_cells, data);
+    int rc;
+
+    if ( depth != 1 )
+        return 0;
+
+    rc = process_memory_node(fdt, node, name, depth, address_cells,
+                             size_cells, data);
 
     if ( rc == -ENOSPC )
         panic("Max number of supported reserved-memory regions reached.\n");
-- 
2.56.0.307.g5fe7bd680c-goog




 


Rackspace

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