All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sandbox: Replace set_working_fdt_addr with pointer version
@ 2018-09-26  9:19 Alexander Graf
  0 siblings, 0 replies; only message in thread
From: Alexander Graf @ 2018-09-26  9:19 UTC (permalink / raw)
  To: u-boot

When running sandbox with the new pointer sanitization we just recently
introduced, we're running into a case with FIT images where we end up
interpreting pointers as addresses.

Since most callers of the set_working_fdt_addr() function are already at
the pointer stage, let's just rename it to set_working_fdt() and pass in
the pointer directly.

This fixes sandbox fit tests for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 cmd/fdt.c             | 10 +++++-----
 common/bootm.c        |  2 +-
 common/image-fdt.c    |  2 +-
 include/fdt_support.h |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 28de467f96..1976e7e6b9 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -36,12 +36,12 @@ static int is_printable_string(const void *data, int len);
  */
 struct fdt_header *working_fdt;
 
-void set_working_fdt_addr(ulong addr)
+void set_working_fdt(char *fdt)
 {
-	void *buf;
+	uintptr_t addr;
 
-	buf = map_sysmem(addr, 0);
-	working_fdt = buf;
+	addr = map_to_sysmem(fdt);
+	working_fdt = fdt;
 	env_set_hex("fdtaddr", addr);
 }
 
@@ -121,7 +121,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (control)
 			gd->fdt_blob = blob;
 		else
-			set_working_fdt_addr(addr);
+			set_working_fdt(map_sysmem(addr, 0));
 
 		if (argc >= 2) {
 			int  len;
diff --git a/common/bootm.c b/common/bootm.c
index e517d9f118..5d3a60927d 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -262,7 +262,7 @@ int bootm_find_images(int flag, int argc, char * const argv[])
 		puts("Could not find a valid device tree\n");
 		return 1;
 	}
-	set_working_fdt_addr((ulong)images.ft_addr);
+	set_working_fdt(images.ft_addr);
 #endif
 
 #if IMAGE_ENABLE_FIT
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 9b41f16248..f685d66fe9 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -193,7 +193,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
 	*of_flat_tree = of_start;
 	*of_size = of_len;
 
-	set_working_fdt_addr((ulong)*of_flat_tree);
+	set_working_fdt(*of_flat_tree);
 	return 0;
 
 error:
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 27fe564f0b..5658296498 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -191,7 +191,7 @@ void ft_pci_setup(void *blob, bd_t *bd);
  */
 int ft_system_setup(void *blob, bd_t *bd);
 
-void set_working_fdt_addr(ulong addr);
+void set_working_fdt(char *fdt);
 
 /**
  * shrink down the given blob to minimum size + some extrasize if required
-- 
2.12.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-26  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  9:19 [U-Boot] [PATCH] sandbox: Replace set_working_fdt_addr with pointer version Alexander Graf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.