libfdt: Remove superfluous NUL character from overlay symbols
PATCH 1/1 libfdt: Remove superfluous NUL character from overlay symbols
The symbol path already ends with a NUL character (something which is actually checked by the code) and this NUL is included in rel_path_len, so there is no need to add a second one.
This change fixes incorrect display in the U-Boot command "fdt list /__symbols__" after applying an overlay with symbols.
--- libfdt/fdt_overlay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
libfdt/fdt_overlay.c +2 -3
@@ -757,7 +757,7 @@ static int overlay_symbol_update(void *fdt, void *fdto) && (memcmp(s, "/__overlay__", len - 1) == 0)) { /* /<fragment-name>/__overlay__ */ rel_path = ""; - rel_path_len = 0; + rel_path_len = 1; /* Include NUL character */ } else {/* Symbol refers to something that won't end * up in the target tree */
@@ -794,7 +794,7 @@ static int overlay_symbol_update(void *fdt, void *fdto) } ret =fdt_setprop_placeholder (fdt, root_sym, name, - len + (len >1 ) + rel_path_len +1 , &p); + len + (len >1 ) + rel_path_len, &p);if (ret <0 )return ret;
@@ -820,7 +820,6 @@ static int overlay_symbol_update(void *fdt, void *fdto) buf[len] ='/' ;memcpy (buf + len +1 , rel_path, rel_path_len); - buf[len +1 + rel_path_len] ='\0' ; }return 0 ;
Signature · 1 line
2.26.2
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Marcus Comstedt
The symbol path already ends with a NUL character (something which is actually checked by the code) and this NUL is included in
rel_path_len, so there is no need to add a second one.This change fixes incorrect display in the U-Boot command "fdt list /__symbols__" after applying an overlay with symbols.
Signed-off-by Marcus Comstedt <[email protected]>
This patch causes "make check" failures.
Quoted 34 lines
--- libfdt/fdt_overlay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)libfdt/fdt_overlay.c +2
-3@@ -757,7 +757,7 @@ static int overlay_symbol_update(void *fdt, void *fdto) && (memcmp(s, "/__overlay__", len - 1) == 0)) { /* /<fragment-name>/__overlay__ */ rel_path = ""; - rel_path_len = 0; + rel_path_len = 1; /* Include NUL character */ } else {/* Symbol refers to something that won't end * up in the target tree */ @@ -794,7 +794,7 @@ static int overlay_symbol_update(void *fdt, void *fdto) } ret =fdt_setprop_placeholder (fdt, root_sym, name, - len + (len >1 ) + rel_path_len +1 , &p); + len + (len >1 ) + rel_path_len, &p);if (ret <0 )return ret;@@ -820,7 +820,6 @@ static int overlay_symbol_update(void *fdt, void *fdto) buf[len] ='/' ;memcpy (buf + len +1 , rel_path, rel_path_len); - buf[len +1 + rel_path_len] ='\0' ; }return 0 ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi David,
Quoted 1 line · David Gibson
This patch causes "make check" failures.
Ah. This patch was for U-Boot, and Simon asked me to upstream it, but I see now that in your repo you already have another fix (d9c55f85) for the same issue. Then applying my fix makes no sense for you of course. Sorry about that.
// Marcus