[rtems commit] libfdt: Copy the struct region in fdt_resize()

Sebastian Huber sebh at rtems.org
Thu Jul 19 05:07:42 UTC 2018


Module:    rtems
Branch:    master
Commit:    4fd05d33272265c01f1864b7d3eb046d9d7ccf27
Changeset: http://git.rtems.org/rtems/commit/?id=4fd05d33272265c01f1864b7d3eb046d9d7ccf27

Author:    Simon Glass <sjg at chromium.org>
Date:      Sat Jul  7 13:57:19 2018 -0600

libfdt: Copy the struct region in fdt_resize()

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.

Signed-off-by: Simon Glass <sjg at chromium.org>
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>

---

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

diff --git a/cpukit/dtc/libfdt/fdt_sw.c b/cpukit/dtc/libfdt/fdt_sw.c
index 178b365..024f4d8 100644
--- a/cpukit/dtc/libfdt/fdt_sw.c
+++ b/cpukit/dtc/libfdt/fdt_sw.c
@@ -170,7 +170,7 @@ int fdt_resize(void *fdt, void *buf, int bufsize)
 
 	FDT_SW_PROBE(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)



More information about the vc mailing list