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

Alexander Egorenkov egorenar at linux.ibm.com
Tue Apr 29 17:30:52 AEST 2025


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>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
-- 
2.49.0



More information about the Linux-erofs mailing list