From ed1c0063aa676d5c48574c3e1ace5ae70d7c6575 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Thu, 4 Feb 2021 20:29:59 -0800 Subject: overlay_fixup_phandle: Save entire fixup string and length Save entire fixup string and length to use when adding to local fixups. At the end of the loop iteration, value points to the last/end of properties list. Fixes commit bdc677a4d68f ("libfdt: overlay_merge: Ignore unresolved symbols"). Change-Id: I2663b52aa64d37af7e31f03b4cc85c856499d841 Signed-off-by: Elliot Berman --- libfdt/fdt_overlay.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c index 8b715d6..531294c 100644 --- a/libfdt/fdt_overlay.c +++ b/libfdt/fdt_overlay.c @@ -548,11 +548,11 @@ static int overlay_add_to_local_fixups(void *fdt, const char *value, int len) static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, int property, int fixups_off, int merge) { - const char *value; + const char *value, *total_value; const char *label; - int len, ret = 0; + int len, total_len, ret = 0; - value = fdt_getprop_by_offset(fdto, property, + total_value = value = fdt_getprop_by_offset(fdto, property, &label, &len); if (!value) { if (len == -FDT_ERR_NOTFOUND) @@ -561,6 +561,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, return len; } + total_len = len; + do { const char *path, *name, *fixup_end; const char *fixup_str = value; @@ -631,7 +633,7 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, * during a subsequent overlay of combined blob on a base blob. */ if (merge) { - ret = overlay_add_to_local_fixups(fdt, value, len); + ret = overlay_add_to_local_fixups(fdt, total_value, total_len); if (!ret) ret = fdt_delprop(fdto, fixups_off, label); } -- cgit v1.2.3-59-g8ed1b