[PATCH v1 1/1] erofs-utils: fix endiannes issue

Hongbo Li lihongbo22 at huawei.com
Tue Apr 29 18:30:17 AEST 2025



On 2025/4/29 15:30, Alexander Egorenkov wrote:
> From: Super User <root at a8345034.lnxne.boe>
> 
> Macros __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN are defined in
> user space header 'endian.h'. Not including this header results in
> the condition #if __BYTE_ORDER == __LITTLE_ENDIAN being always true, even on
> BE architectures (e.g. s390x). Due to this bug the compressor library was
> built for LE byte-order on BE arch s390x.
> 
> Fixes: bc99c763e3fe ("erofs-utils: switch to effective unaligned access")
> Signed-off-by: Alexander Egorenkov <egorenar at linux.ibm.com>
> ---
>   include/erofs/defs.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/include/erofs/defs.h b/include/erofs/defs.h
> index 051a270531ca..196dfa8191a8 100644
> --- a/include/erofs/defs.h
> +++ b/include/erofs/defs.h
> @@ -19,6 +19,7 @@ extern "C"
>   #include <inttypes.h>
>   #include <limits.h>
>   #include <stdbool.h>
> +#include <endian.h>
>   

Reviewed-by: Hongbo Li <lihongbo22 at huawei.com>

>   #ifdef HAVE_CONFIG_H
>   #include <config.h>


More information about the Linux-erofs mailing list