[PATCH] filetype: fix unaligned access for x86_linux_bootimage

Steffen Trumtrar s.trumtrar at pengutronix.de
Tue Apr 7 00:34:15 PDT 2026


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 at 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 at pengutronix.de>




More information about the barebox mailing list