From: Benjamin Herrenschmidt Date: Mon, 22 Oct 2012 00:32:30 +0000 (+1100) Subject: of/fdt: Don't copy garbage after "/" in root node path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=509b7455ef87e1447670c51037cabbf93d772d6f;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git of/fdt: Don't copy garbage after "/" in root node path 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 Signed-off-by: Rob Herring --- diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 91a375fb6ae6..c2b08dcdbc53 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'