From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org, Sascha Hauer <s.hauer@pengutronix.de>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH] filetype: fix unaligned access for x86_linux_bootimage
Date: Tue, 07 Apr 2026 09:34:15 +0200 [thread overview]
Message-ID: <20260407-v2026-03-1-topic-filetype-v1-1-e2fd029ab0d4@pengutronix.de> (raw)
is_x86_linux_bootimage tries to access an unaligned pointer which may
lead to errors on SoCs that don't allow it (e.g. ARMv5)
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
include/filetype.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/filetype.h b/include/filetype.h
index d404e0cf3c..759ef9c2a3 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -5,6 +5,7 @@
#include <linux/string.h>
#include <linux/types.h>
#include <asm/byteorder.h>
+#include <asm/unaligned.h>
/*
* List of file types we know
@@ -170,7 +171,7 @@ static inline bool is_riscv_linux_bootimage(const void *header)
static inline bool is_x86_linux_bootimage(const void *header)
{
- return le32_to_cpup(header + 0x202) == 0x53726448;
+ return get_unaligned_le32(header + 0x202) == 0x53726448;
}
#endif /* __FILE_TYPE_H */
---
base-commit: 1d386a53086d28a0c4eda138ae9408a418b97b7e
change-id: 20260407-v2026-03-1-topic-filetype-1255d131e636
Best regards,
--
Steffen Trumtrar <s.trumtrar@pengutronix.de>
next reply other threads:[~2026-04-07 7:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 7:34 Steffen Trumtrar [this message]
2026-04-07 7:50 ` Ahmad Fatoum
2026-04-13 7:32 ` Sascha Hauer
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=20260407-v2026-03-1-topic-filetype-v1-1-e2fd029ab0d4@pengutronix.de \
--to=s.trumtrar@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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