[PATCH] filetype: fix unaligned access for x86_linux_bootimage

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 7 00:50:30 PDT 2026


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

Reviewed-by: Ahmad Fatoum <a.fatoum at 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 at 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 |



More information about the barebox mailing list