[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260112142009.1006236-52-herve.codina@bootlin.com>
Date: Mon, 12 Jan 2026 15:19:41 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: David Gibson <david@...son.dropbear.id.au>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: Ayush Singh <ayush@...gleboard.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
devicetree-compiler@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
devicetree-spec@...r.kernel.org,
Hui Pu <hui.pu@...ealthcare.com>,
Ian Ray <ian.ray@...ealthcare.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>
Subject: [RFC PATCH 51/77] dtc: Avoid NULL fullpath for nodes in orphan trees
Orphan nodes have been introduced recently.
The process_checks() function uses fullpath in several places and
crashes due NULL pointer dereferences if fullpath is NULL.
In order to have process_checks() function running without crashes with
orphan trees (i.e. trees based on orphan nodes), the fullpath of node
available in those orphan trees must not be NULL.
Fullpath values are built by dti_fill_fullpaths(). Update it to handle
fullpath in trees based on orphan nodes.
Use a simple "__orphan__/" prefix to avoid the NULL pointer and to be
distinct from the root node ("/" prefix).
It is worth noting that this "__orphan__/" prefix is a temporary prefix
and it will be change later when support for reference by path involving
nodes in orphan tree is added.
Signed-off-by: Herve Codina <herve.codina@...tlin.com>
---
dtc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dtc.c b/dtc.c
index 59f4d77..5cf8f31 100644
--- a/dtc.c
+++ b/dtc.c
@@ -47,9 +47,14 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
static void dti_fill_fullpaths(struct dt_info *dti)
{
+ struct node *orphan;
+
/* Fill fullpaths for the root node */
if (dti->dt)
fill_fullpaths(dti->dt, "");
+
+ for_each_orphan(dti->orphanlist, orphan)
+ fill_fullpaths(orphan, "__orphan__/");
}
/* Usage related data. */
--
2.52.0
Powered by blists - more mailing lists