# \[PATCH\] of/fdt: Don't copy garbage after "/" in root node path

- From: Benjamin Herrenschmidt \<hidden\>
- Date: 2012-10-22 00:32:30 
- List: linux-devicetree
- Page: https://ratatoskr.run/linux-devicetree/2012/10/8064414
- Thread: https://ratatoskr.run/linux-devicetree/2012/10/8064414/t.md

```text
The root node path must be internally converted to "/", or various
pieces of code looking for it that way will fail. The code to do
that however had a bug where we might incorrectly append pieces
of the original path from the fdt to the "/".

We should probably add a proper dedicated accessor for the root node
but in the meantime this patch should fix it.

Signed-off-by: Benjamin Herrenschmidt <redacted>
---
 drivers/of/fdt.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 91a375f..c2b08dc 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -186,6 +186,7 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob,
 			 */
 			fpsize = 1;
 			allocl = 2;
+			l = 0;
 		} else {
 			/* account for '/' and path size minus terminal 0
 			 * already in 'l'
```
