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 <eberman@codeaurora.org>
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_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 @@
return len;
}
+ total_len = len;
+
do {
const char *path, *name, *fixup_end;
const char *fixup_str = value;
@@ -631,7 +633,7 @@
* 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);
}