diff options
| author | Oleksandr Andrushchenko <[email protected]> | 2020-06-19 11:22:18 +0300 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2020-07-07 09:45:07 -0400 |
| commit | 53007fc1eb892cd67af97c545eb3461020cc3885 (patch) | |
| tree | ed50b506eb38e727a905aed6aebc7098c0dd5242 /common | |
| parent | 23da3c682a84a2ad67a67287979dd4f5259ff607 (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.c | 2 |
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 |
