aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2013-07-25 04:18:17 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-07-26 07:25:21 -0400
commit3b0040a47ad63f7147e9e7d2febb61a3b564bb90 (patch)
treeb22f1711618c557b41a5d37b139f0cfe532ad67c /arch
parent594712276e737961d30e11eae80d403b2b3815df (diff)
s390/bitops: fix find_next_bit_left
The find_next_bit_left function is broken if used with an offset which is not a multiple of 64. The shift to mask the bits of a 64-bit word not to search is in the wrong direction, the result can be either a bit found smaller than the offset or failure to find a set bit. Cc: <stable@vger.kernel.org> # v3.8+ Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/bitops.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 4d8604e311f3..7d4676758733 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -693,7 +693,7 @@ static inline int find_next_bit_left(const unsigned long *addr,
693 size -= offset; 693 size -= offset;
694 p = addr + offset / BITS_PER_LONG; 694 p = addr + offset / BITS_PER_LONG;
695 if (bit) { 695 if (bit) {
696 set = __flo_word(0, *p & (~0UL << bit)); 696 set = __flo_word(0, *p & (~0UL >> bit));
697 if (set >= size) 697 if (set >= size)
698 return size + offset; 698 return size + offset;
699 if (set < BITS_PER_LONG) 699 if (set < BITS_PER_LONG)