From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] ARM: uncompress: keep handoff data aligned
Date: Fri, 22 May 2026 09:22:30 +0200 [thread overview]
Message-ID: <20260522072247.2267979-2-a.fatoum@pengutronix.de> (raw)
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
reply other threads:[~2026-05-22 7:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260522072247.2267979-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox