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

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


  • To: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 27 Oct 2026 14:27:23 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=/nY8jl+8X9fgjGf++R0V+RqjAbDRWNwf395vyKfYKDI=; b=nmVJp1Ry5Wt3z3sN4ZkWnfkdQtRz2x7LNY6FsZCg5KxlHyl7QdE+iVWDLMzca4yVYrvUBaE3S3lL06UnRyujgnBjBw2oZXlqcxTlHcTcdblzS36ktKxaiD0tnA8aA9ae0CV9n1qs7SRKls5/Z7CkS7lE2YE+nPy4/5i1xLkA+ZoH39EvAQQuCVhKAXt8XGcifYaH7RTYvlUif+2QGMbp6EM9T7LPYkasehXETjwSXJoFx+8WFpNeVN+WchLyxDtuLYsFfdUccHK3sjNLUxGZ0H3I4ykMBJ8u0GExx8nlPj436xftQj1cIEzIdO83QiBdDwfUVo3uC0fxeVLaTFStGA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l93f7Ky9MhjiYbNIItbBhRYmEC5WRa1fT5MU9ee/1Cn9kpn20KBlZYozqeEefBJu/tKp5iH/kldL0HwcEaoIjai/lViqvG+KuEY2ANyjfyZL3BNgqXXseSYWGxUhGnvQe1ybSnSJ7O6PG3k2G1qhPcuJ2QKmAw+VOkEY+S2bUNC/twnOit1Ra6I3LHzBAj83eSS1HWw/6RlDCZaleSrX7DweyGUBd0R8C/IY8SqHNM2zIt0c2+K7oUHxTyrDMoCw3J5tqL4DOI60LWjeS+u2jDjTZIdYNtuNjvbi+sO7WbtkuNWmYaTRuwxJaS1ct8e5Q0tlHE3MsHLS9fgoMGs+eg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, <bertrand.marquis@xxxxxxx>, <marscheng@xxxxxxxxxx>, <jserv@xxxxxxxxxxxxxxxx>, <eleanor15x@xxxxxxxxx>
  • Delivery-date: Tue, 27 Oct 2026 13:28:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 27-Oct-26 04:18, Kuan-Wei Chiu wrote:
> 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;
> +
It would be easier to understand with the comment like:
/* Only direct children of /reserved-memory describe memory regions */

> +    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");

I will change on commit. Thanks for the submission.
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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