stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "sh: cmpxchg: fix a bit shift bug in big_endian os" has been added to the 4.7-stable tree
@ 2016-09-22 15:43 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-09-22 15:43 UTC (permalink / raw)
  To: xinhui.pan, dalias, gregkh, mst; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From ff18143ceed3424b7d6cdb8659b9692fa734f0d8 Mon Sep 17 00:00:00 2001
From: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Date: Wed, 20 Apr 2016 14:41:00 +0800
Subject: sh: cmpxchg: fix a bit shift bug in big_endian os

From: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>

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")
Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rich Felker <dalias@libc.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/sh/include/asm/cmpxchg-xchg.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/sh/include/asm/cmpxchg-xchg.h
+++ b/arch/sh/include/asm/cmpxchg-xchg.h
@@ -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 xinhui.pan@linux.vnet.ibm.com are

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-22 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-22 15:43 Patch "sh: cmpxchg: fix a bit shift bug in big_endian os" has been added to the 4.7-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).