A pointer to the handoff data is passed from PBL to barebox proper as argument, but it may end up unaligned depending on uncompressed_len.
Round that up to 8 bytes to make sure, it doesn't end up misaligned. Signed-off-by: Ahmad Fatoum <[email protected]> --- arch/arm/cpu/uncompress.c | 2 +- arch/arm/include/asm/barebox-arm.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c index db6cd7fa11d7..61bcba6e8549 100644 --- a/arch/arm/cpu/uncompress.c +++ b/arch/arm/cpu/uncompress.c @@ -73,7 +73,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize, barebox_base = arm_mem_barebox_image(membase, endmem, uncompressed_len, NULL); - handoff_data = (void *)barebox_base + uncompressed_len + MAX_BSS_SIZE; + handoff_data = (void *)barebox_base + ALIGN(uncompressed_len, 8) + MAX_BSS_SIZE; pbl_malloc_init(barebox_base - PBL_MALLOC_SIZE, PBL_MALLOC_SIZE); diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index 9349e62fdec6..38cceba010ed 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -193,7 +193,8 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase, const struct handoff_data *handoff_data) { #ifdef __PBL__ - unsigned long size = uncompressed_len + MAX_BSS_SIZE + __handoff_data_size(handoff_data); + unsigned long size = ALIGN(uncompressed_len, 8) + + MAX_BSS_SIZE + __handoff_data_size(handoff_data); endmem = arm_mem_ramoops(endmem); -- 2.47.3
