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

* Re: [PATCH] filetype: fix unaligned access for x86_linux_bootimage
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-04-07  7:50 UTC (permalink / raw)
  To: Steffen Trumtrar, barebox, Sascha Hauer

On 4/7/26 09:34, Steffen Trumtrar wrote:
> 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>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Thanks!
Ahmad

> ---
>  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>
> 
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [PATCH] filetype: fix unaligned access for x86_linux_bootimage
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-04-13  7:32 UTC (permalink / raw)
  To: barebox, Steffen Trumtrar


On Tue, 07 Apr 2026 09:34:15 +0200, Steffen Trumtrar wrote:
> 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)
> 
> 

Applied, thanks!

[1/1] filetype: fix unaligned access for x86_linux_bootimage
      https://git.pengutronix.de/cgit/barebox/commit/?id=87d3ae4bee6c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@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