mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] filetype: fix unaligned access for x86_linux_bootimage
@ 2026-04-07  7:34 Steffen Trumtrar
  2026-04-07  7:50 ` Ahmad Fatoum
  2026-04-13  7:32 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Steffen Trumtrar @ 2026-04-07  7:34 UTC (permalink / raw)
  To: barebox, Sascha Hauer; +Cc: Steffen Trumtrar

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>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-13  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-07  7:34 [PATCH] filetype: fix unaligned access for x86_linux_bootimage Steffen Trumtrar
2026-04-07  7:50 ` Ahmad Fatoum
2026-04-13  7:32 ` Sascha Hauer

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