Skip to contentSkip to conversation

lib : lz4 using put_unaligned_le16 instead of put_unaligned

PATCH In review Eunbong Song 2 participants 2 messages Jul 22, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib : lz4 using put_unaligned_le16 instead of put_unaligned

In case of mips bigendian machine, put_unaligned writes bigendian bytes order.
This is defined in arch/mips/include/asm/unaligned.h. So it's right use put_unaligned_le16 function instead of put_unaligned. This patch also fixes problem fail to mount zram ext4 partition with "zram: Decompression failed! err=-1, page=0" in mips bigendian machine.

---
 lib/lz4/lz4defs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/lz4/lz4defs.h +1 -1
index abcecdc..dc7ef14 100644
@@ -53,7 +53,7 @@ typedef struct _U64_S { u64 v; } U64_S;
 
 #define LZ4_WRITE_LITTLEENDIAN_16(p, v)	\
 	do {	\
-		put_unaligned(v, (u16 *)(p)); \
+		put_unaligned_le16(v, (u16 *)(p)); \
 		p += 2; \
 	} while (0)
 #endif
Signature · 2 lines
1.7.0.1
�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�
#1 lore raw
Quoted 4 lines · Eunbong Song

In case of mips bigendian machine, put_unaligned writes bigendian bytes order.
This is defined in arch/mips/include/asm/unaligned.h. So it's right use put_unaligned_le16 function instead of put_unaligned. This patch also fixes problem fail to mount zram ext4 partition with "zram: Decompression failed! err=-1, page=0" in mips bigendian machine.

Odd line wrapping :(

Anyway, is this a new problem? Or something that has always been there in this compression function?

thanks,

greg k-h