[PATCH 06/18] sparc32: tolerate firmware nodes without a name property

From: Magnus Lindholm

Date: Thu Nov 26 2026 - 04:31:48 EST


Factory LEON U-Boot omits device-tree name properties, causing
build_path_component() to dereference NULL. Use an empty root component
and phandle-based child names when the property is absent.

Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/kernel/prom_32.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c
index cd94f1e8d644..804ca0b2a5b5 100644
--- a/arch/sparc/kernel/prom_32.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -189,11 +189,21 @@ char * __init build_path_component(struct device_node *dp)
char tmp_buf[64], *n;
size_t n_sz;

+ /* Old LEON firmware omits the root name; handle unnamed children too. */
+ if (!name) {
+ if (dp->parent)
+ snprintf(tmp_buf, sizeof(tmp_buf), "node@%x", dp->phandle);
+ else
+ tmp_buf[0] = '\0';
+ goto alloc_name;
+ }
+
tmp_buf[0] = '\0';
__build_path_component(dp, tmp_buf);
if (tmp_buf[0] == '\0')
strscpy(tmp_buf, name);

+alloc_name:
n_sz = strlen(tmp_buf) + 1;
n = prom_early_alloc(n_sz);
strscpy(n, tmp_buf, n_sz);
--
2.43.0