sandbox: Fix set_working_fdt_addr users
authorAlexander Graf <agraf@suse.de>
Wed, 26 Sep 2018 12:07:41 +0000 (14:07 +0200)
committerAlexander Graf <agraf@suse.de>
Wed, 26 Sep 2018 13:03:12 +0000 (15:03 +0200)
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.

What happened is that most callers of set_working_fdt_addr() simply
convert pointers into addresses without taking into account that they
might be 2 separate address spaces. Fix the callers up to map their
pointers into addresses.

This makes sandbox tests pass for me again.

Signed-off-by: Alexander Graf <agraf@suse.de>
common/bootm.c
common/image-fdt.c

index e517d9f118a8e2bd8c9623725a712a638d9b540d..8bf84ebcb7e82e798f1a718625e2938e1b773bd4 100644 (file)
@@ -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_addr(map_to_sysmem(images.ft_addr));
 #endif
 
 #if IMAGE_ENABLE_FIT
index 9b41f1624848a3fb7cd95b7ea411622d62f8e8b9..95748f0ae108035cc71845d2d7d99e7ff2118115 100644 (file)
@@ -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_addr(map_to_sysmem(*of_flat_tree));
        return 0;
 
 error: