diff --git a/boot/image-fit.c b/boot/image-fit.c index 2f2d3e9304d..cccaa48f683 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #ifdef CONFIG_DM_HASH @@ -36,6 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; #include #include #include +#include #include #include @@ -2279,7 +2279,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, log_debug("decompressing image\n"); if (load == data) { - loadbuf = malloc(max_decomp_len); + loadbuf = memalign(8, max_decomp_len); load = map_to_sysmem(loadbuf); } else { loadbuf = map_sysmem(load, max_decomp_len); @@ -2291,6 +2291,11 @@ int fit_image_load(struct bootm_headers *images, ulong addr, return -ENOEXEC; } len = load_end - load; + } else if (load_op != FIT_LOAD_IGNORED && image_type == IH_TYPE_FLATDT && + ((uintptr_t)buf & 7)) { + loadbuf = memalign(8, len); + load = map_to_sysmem(loadbuf); + memcpy(loadbuf, buf, len); } else if (load != data) { log_debug("copying\n"); loadbuf = map_sysmem(load, len);