[RFC PATCH v2 46/74] dtc: Avoid NULL fullpath for nodes in orphan trees
From: Herve Codina
Date: Wed Aug 26 2026 - 06:10:08 EST
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@xxxxxxxxxxx>
---
livetree.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/livetree.c b/livetree.c
index c61025a5..8f0aa868 100644
--- a/livetree.c
+++ b/livetree.c
@@ -561,9 +561,14 @@ static void fill_fullpaths_(struct node *tree, const char *prefix)
static void 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__/");
}
static void complete_ref_and_is_local(struct dt_info *dti, char **ref,
--
2.55.0