[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Feb 2021 14:37:17 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Chris Packham <chris.packham@...iedtelesis.co.nz>,
Qi Zheng <arch0.zheng@...il.com>,
Russell King <linux@...linux.org.uk>,
Rob Herring <robh@...nel.org>
Subject: [PATCH 5.10 074/142] ARM: zImage: atags_to_fdt: Fix node names on added root nodes
From: Rob Herring <robh@...nel.org>
commit 30596ae0547dbda469d31a2678d9072fb0a3fa27 upstream.
Commit 7536c7e03e74 ("of/fdt: Remove redundant kbasename function
call") exposed a bug creating DT nodes in the ATAGS to DT fixup code.
Non-existent nodes would mistaken get created with a leading '/'. The
problem was fdt_path_offset() takes a full path while creating a node
with fdt_add_subnode() takes just the basename.
Since this we only add root child nodes, we can just skip over the '/'.
Fixes: 7536c7e03e74 ("of/fdt: Remove redundant kbasename function call")
Reported-by: Chris Packham <chris.packham@...iedtelesis.co.nz>
Cc: Qi Zheng <arch0.zheng@...il.com>
Cc: Russell King <linux@...linux.org.uk>
Signed-off-by: Rob Herring <robh@...nel.org>
Tested-by: Chris Packham <chris.packham@...iedtelesis.co.nz>
Link: https://lore.kernel.org/r/20210126023905.1631161-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
arch/arm/boot/compressed/atags_to_fdt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/arch/arm/boot/compressed/atags_to_fdt.c
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -15,7 +15,8 @@ static int node_offset(void *fdt, const
{
int offset = fdt_path_offset(fdt, node_path);
if (offset == -FDT_ERR_NOTFOUND)
- offset = fdt_add_subnode(fdt, 0, node_path);
+ /* Add the node to root if not found, dropping the leading '/' */
+ offset = fdt_add_subnode(fdt, 0, node_path + 1);
return offset;
}
Powered by blists - more mailing lists