From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH] common/board_f: Respect original FDT size while relocating
Date: Fri, 19 Jun 2020 11:22:18 +0300 [thread overview]
Message-ID: <20200619082218.656-1-andr2000@gmail.com> (raw)
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
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 <oleksandr_andrushchenko@epam.com>
---
common/board_f.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/board_f.c b/common/board_f.c
index 01194eaa0e4d..aa1285e94999 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
--
2.17.1
next reply other threads:[~2020-06-19 8:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 8:22 Oleksandr Andrushchenko [this message]
2020-06-19 13:53 ` [PATCH] common/board_f: Respect original FDT size while relocating Tom Rini
2020-06-19 15:19 ` Oleksandr Andrushchenko
2020-06-19 17:51 ` Tom Rini
2020-06-19 18:21 ` Oleksandr Andrushchenko
2020-06-26 1:43 ` Simon Glass
2020-07-07 16:55 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200619082218.656-1-andr2000@gmail.com \
--to=andr2000@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox