From: Greg Kroah-Hartman Date: Thu, 28 Apr 2016 00:17:07 +0000 (-0700) Subject: 3.14-stable patches X-Git-Tag: v3.14.68~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b31f41791ae583d9242ce9e845d13774bb9b7e8;p=thirdparty%2Fkernel%2Fstable-queue.git 3.14-stable patches added patches: lib-lz4-fixed-zram-with-lz4-on-big-endian-machines.patch --- diff --git a/queue-3.14/lib-lz4-fixed-zram-with-lz4-on-big-endian-machines.patch b/queue-3.14/lib-lz4-fixed-zram-with-lz4-on-big-endian-machines.patch new file mode 100644 index 00000000000..96664dd8f2a --- /dev/null +++ b/queue-3.14/lib-lz4-fixed-zram-with-lz4-on-big-endian-machines.patch @@ -0,0 +1,81 @@ +From 3e26a691fe3fe1e02a76e5bab0c143ace4b137b4 Mon Sep 17 00:00:00 2001 +From: Rui Salvaterra +Date: Sat, 9 Apr 2016 22:05:34 +0100 +Subject: lib: lz4: fixed zram with lz4 on big endian machines + +From: Rui Salvaterra + +commit 3e26a691fe3fe1e02a76e5bab0c143ace4b137b4 upstream. + +Based on Sergey's test patch [1], this fixes zram with lz4 compression +on big endian cpus. + +Note that the 64-bit preprocessor test is not a cleanup, it's part of +the fix, since those identifiers are bogus (for example, __ppc64__ +isn't defined anywhere else in the kernel, which means we'd fall into +the 32-bit definitions on ppc64). + +Tested on ppc64 with no regression on x86_64. + +[1] http://marc.info/?l=linux-kernel&m=145994470805853&w=4 + +Suggested-by: Sergey Senozhatsky +Signed-off-by: Rui Salvaterra +Reviewed-by: Sergey Senozhatsky +Signed-off-by: Greg Kroah-Hartman + +--- + lib/lz4/lz4defs.h | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +--- a/lib/lz4/lz4defs.h ++++ b/lib/lz4/lz4defs.h +@@ -11,8 +11,7 @@ + /* + * Detects 64 bits mode + */ +-#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) \ +- || defined(__ppc64__) || defined(__LP64__)) ++#if defined(CONFIG_64BIT) + #define LZ4_ARCH64 1 + #else + #define LZ4_ARCH64 0 +@@ -35,6 +34,10 @@ typedef struct _U64_S { u64 v; } U64_S; + + #define PUT4(s, d) (A32(d) = A32(s)) + #define PUT8(s, d) (A64(d) = A64(s)) ++ ++#define LZ4_READ_LITTLEENDIAN_16(d, s, p) \ ++ (d = s - A16(p)) ++ + #define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ + do { \ + A16(p) = v; \ +@@ -51,10 +54,13 @@ typedef struct _U64_S { u64 v; } U64_S; + #define PUT8(s, d) \ + put_unaligned(get_unaligned((const u64 *) s), (u64 *) d) + +-#define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ +- do { \ +- put_unaligned(v, (u16 *)(p)); \ +- p += 2; \ ++#define LZ4_READ_LITTLEENDIAN_16(d, s, p) \ ++ (d = s - get_unaligned_le16(p)) ++ ++#define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ ++ do { \ ++ put_unaligned_le16(v, (u16 *)(p)); \ ++ p += 2; \ + } while (0) + #endif + +@@ -140,9 +146,6 @@ typedef struct _U64_S { u64 v; } U64_S; + + #endif + +-#define LZ4_READ_LITTLEENDIAN_16(d, s, p) \ +- (d = s - get_unaligned_le16(p)) +- + #define LZ4_WILDCOPY(s, d, e) \ + do { \ + LZ4_COPYPACKET(s, d); \ diff --git a/queue-3.14/series b/queue-3.14/series index aec5c2fe2ae..738a7e20178 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -2,3 +2,4 @@ arm-omap2-hwmod-fix-updating-of-sysconfig-register.patch assoc_array-don-t-call-compare_object-on-a-node.patch usb-xhci-fix-wild-pointers-in-xhci_mem_cleanup.patch usb-hcd-out-of-bounds-access-in-for_each_companion.patch +lib-lz4-fixed-zram-with-lz4-on-big-endian-machines.patch