Skip to contentSkip to conversation

Patch "sh: cmpxchg: fix a bit shift bug in big_endian os" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 22, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

sh: cmpxchg: fix a bit shift bug in big_endian os

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sh-cmpxchg-fix-a-bit-shift-bug-in-big_endian-os.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From ff18143ceed3424b7d6cdb8659b9692fa734f0d8 Mon Sep 17 00:00:00 2001

From: Pan Xinhui <[email protected]>
Date: Wed, 20 Apr 2016 14:41:00 +0800
Subject: sh: cmpxchg: fix a bit shift bug in big_endian os

From: Pan Xinhui <[email protected]>

commit ff18143ceed3424b7d6cdb8659b9692fa734f0d8 upstream.

Correct bitoff in big endian OS.
Current code works correctly for 1 byte but not for 2 bytes.

Fixes 3226aad81aa6 ("sh: support 1 and 2 byte xchg")
---
 arch/sh/include/asm/cmpxchg-xchg.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/asm/cmpxchg-xchg.h +1 -1
@@ -21,7 +21,7 @@ static inline u32 __xchg_cmpxchg(volatil
 	int off = (unsigned long)ptr % sizeof(u32);
 	volatile u32 *p = ptr - off;
 #ifdef __BIG_ENDIAN
-	int bitoff = (sizeof(u32) - 1 - off) * BITS_PER_BYTE;
+	int bitoff = (sizeof(u32) - size - off) * BITS_PER_BYTE;
 #else
 	int bitoff = off * BITS_PER_BYTE;
 #endif

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

queue-4.7/sh-cmpxchg-fix-a-bit-shift-bug-in-big_endian-os.patch