Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b0040a4 authored by Martin Schwidefsky's avatar Martin Schwidefsky
Browse files

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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 59471227
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -693,7 +693,7 @@ static inline int find_next_bit_left(const unsigned long *addr,
	size -= offset;
	p = addr + offset / BITS_PER_LONG;
	if (bit) {
		set = __flo_word(0, *p & (~0UL << bit));
		set = __flo_word(0, *p & (~0UL >> bit));
		if (set >= size)
			return size + offset;
		if (set < BITS_PER_LONG)