summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOleksandr Andrushchenko <[email protected]>2020-06-19 11:22:18 +0300
committerTom Rini <[email protected]>2020-07-07 09:45:07 -0400
commit53007fc1eb892cd67af97c545eb3461020cc3885 (patch)
treeed50b506eb38e727a905aed6aebc7098c0dd5242 /common
parent23da3c682a84a2ad67a67287979dd4f5259ff607 (diff)
common/board_f: Respect original FDT size while relocating
While relocating FDT we reserve some memory for the new FDT and set the size of the FDT with that respect. But FDT may be placed at the end of the RAM leading to memory access beyond it. Fix this by copying exact FDT size bytes, not the reserved size. Signed-off-by: Oleksandr Andrushchenko <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'common')
-rw-r--r--common/board_f.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/board_f.c b/common/board_f.c
index dcad551ae43..b61036577a5 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -670,7 +670,7 @@ static int reloc_fdt(void)
if (gd->flags & GD_FLG_SKIP_RELOC)
return 0;
if (gd->new_fdt) {
- memcpy(gd->new_fdt, gd->fdt_blob, gd->fdt_size);
+ memcpy(gd->new_fdt, gd->fdt_blob, fdt_totalsize(gd->fdt_blob));
gd->fdt_blob = gd->new_fdt;
}
#endif