summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2020-05-22 18:41:36 +0200
committerSimon Glass <sjg@chromium.org>2020-06-11 20:52:11 -0600
commit42a768c6892ba3bdedea75a430dff234fddffc8d (patch)
tree71212c3bf1a3566375fea9c5d50c1862fe121e1c /scripts
parent2f8f5e23539819dcf9c995d7a829dbac67d0ba27 (diff)
downloadu-boot-42a768c6892ba3bdedea75a430dff234fddffc8d.tar.gz
u-boot-42a768c6892ba3bdedea75a430dff234fddffc8d.tar.xz
u-boot-42a768c6892ba3bdedea75a430dff234fddffc8d.zip
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 "fdt list /__symbols" after applying an overlay with symbols. Signed-off-by: Marcus Comstedt <marcus@mc.pp.se> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/dtc/libfdt/fdt_overlay.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/dtc/libfdt/fdt_overlay.c b/scripts/dtc/libfdt/fdt_overlay.c
index c090e6991e..bd75e3dd78 100644
--- a/scripts/dtc/libfdt/fdt_overlay.c
+++ b/scripts/dtc/libfdt/fdt_overlay.c
@@ -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;