summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@mailbox.org>2023-03-02 06:08:22 +0300
committerSimon Glass <sjg@chromium.org>2023-03-08 22:40:57 +0300
commitc2a5d1078027b6c0480eda45bd4d2eae80ceb67e (patch)
treedd51622cf055c17eb615d947567cd98f664bfcda /cmd
parent22cbd654d33f60b7d7941c4ba2484bcc610f4e50 (diff)
downloadu-boot-c2a5d1078027b6c0480eda45bd4d2eae80ceb67e.tar.xz
cmd: fdt: Map address returned from fdt get addr to sysmem
The address returned from 'fdt get addr' command must be mapped into sysmem, as this is a working FDT. Access to this address without mapping it would lead to crash e.g. in sandbox. The following command triggers the crash: " ./u-boot -Dc 'fdt addr $fdtcontroladdr ; fdt get addr var / compatible ; md $var' " Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/fdt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/fdt.c b/cmd/fdt.c
index bc19303159..f2576ab4b3 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -468,7 +468,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/* Get address */
char buf[19];
- snprintf(buf, sizeof(buf), "0x%p", nodep);
+ snprintf(buf, sizeof(buf), "0x%lx",
+ (ulong)map_to_sysmem(nodep));
env_set(var, buf);
} else if (subcmd[0] == 's') {
/* Get size */