[U-Boot,37/53] libfdt: Copy the struct region in fdt_resize()
diff mbox series

Message ID 20190720182416.183626-38-sjg@chromium.org
State Accepted
Commit 89d66907b37b2578b0e998faf3ba8ef66c6a7606
Delegated to: Simon Glass
Headers show
Series
  • binman: Support replacing entries in an existing image
Related show

Commit Message

Simon Glass July 20, 2019, 6:23 p.m. UTC
At present this function appears to copy only the data before the struct
region and the data in the string region. It does not seem to copy the
struct region itself.

From the arguments of this function it seems that it should support fdt
and buf being different. This patch attempts to fix this problem.

Upstream commit: c72fa77 libfdt: Copy the struct region in fdt_resize()

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 scripts/dtc/libfdt/fdt_sw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass July 29, 2019, 9:22 p.m. UTC | #1
At present this function appears to copy only the data before the struct
region and the data in the string region. It does not seem to copy the
struct region itself.

From the arguments of this function it seems that it should support fdt
and buf being different. This patch attempts to fix this problem.

Upstream commit: c72fa77 libfdt: Copy the struct region in fdt_resize()

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 scripts/dtc/libfdt/fdt_sw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm, thanks!

Patch
diff mbox series

diff --git a/scripts/dtc/libfdt/fdt_sw.c b/scripts/dtc/libfdt/fdt_sw.c
index 6d33cc29d02..d8ef748a721 100644
--- a/scripts/dtc/libfdt/fdt_sw.c
+++ b/scripts/dtc/libfdt/fdt_sw.c
@@ -114,7 +114,7 @@  int fdt_resize(void *fdt, void *buf, int bufsize)
 
 	FDT_SW_CHECK_HEADER(fdt);
 
-	headsize = fdt_off_dt_struct(fdt);
+	headsize = fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt);
 	tailsize = fdt_size_dt_strings(fdt);
 
 	if ((headsize + tailsize) > bufsize)