mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] ARM: uncompress: keep handoff data aligned
@ 2026-05-22  7:22 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2026-05-22  7:22 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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 <a.fatoum@pengutronix.de>
---
 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




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

only message in thread, other threads:[~2026-05-22  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22  7:22 [PATCH master] ARM: uncompress: keep handoff data aligned Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox