Skip to contentSkip to conversation

lib-lzo-fix-alignment-bug-in-lzo-rle.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 26, 2019 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: lib/lzo/lzo1x_compress.c: fix alignment bug in lzo-rle
has been removed from the -mm tree. Its filename was
lib-lzo-fix-alignment-bug-in-lzo-rle.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Dave Rodgman <[email protected]>
Subject: lib/lzo/lzo1x_compress.c: fix alignment bug in lzo-rle

Fix an unaligned access which breaks on platforms where this is not permitted (e.g., Sparc).

---

 lib/lzo/lzo1x_compress.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
lib/lzo/lzo1x_compress.c renamed from lib/lzo/lzo1x_compress.c~lib-lzo-fix-alignment-bug-in-lzo-rle +8 -6
@@ -83,17 +83,19 @@ next:
 					ALIGN((uintptr_t)ir, 4)) &&
 					(ir < limit) && (*ir == 0))
 				ir++;
-			for (; (ir + 4) <= limit; ir += 4) {
-				dv = *((u32 *)ir);
-				if (dv) {
+			if (IS_ALIGNED((uintptr_t)ir, 4)) {
+				for (; (ir + 4) <= limit; ir += 4) {
+					dv = *((u32 *)ir);
+					if (dv) {
 #  if defined(__LITTLE_ENDIAN)
-					ir += __builtin_ctz(dv) >> 3;
+						ir += __builtin_ctz(dv) >> 3;
 #  elif defined(__BIG_ENDIAN)
-					ir += __builtin_clz(dv) >> 3;
+						ir += __builtin_clz(dv) >> 3;
 #  else
 #    error "missing endian definition"
 #  endif
-					break;
+						break;
+					}
 				}
 			}
 #endif

_

Patches currently in -mm which might be from [email protected] are