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

Gao Xiang xiang at kernel.org
Tue Apr 29 23:54:34 AEST 2025


Hi Alexander,

On Tue, Apr 29, 2025 at 09:30:52AM +0200, Alexander Egorenkov wrote:
> From: Super User <root at a8345034.lnxne.boe>

Thanks for catching this, the "From:" line seems invalid, so
I change it as "From: Alexander Egorenkov <egorenar at linux.ibm.com>"

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

I guess it could break MacOS compilation, so I update as below:



More information about the Linux-erofs mailing list