[PATCH] s390: find_next_{zero}_bit fixes
commitafff7e2b3b13dbd26a2b9991d3d571df111d92e8
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 27 Jul 2005 18:44:58 +0000 (27 11:44 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 27 Jul 2005 23:26:04 +0000 (27 16:26 -0700)
tree51142ff8f5160bcd317120ffba604653c9e34455
parent951f22d5b1f0eaae35dafc669e3774a0c2084d10
[PATCH] s390: find_next_{zero}_bit fixes

The find_next_{zero}_bit primitives on s390* should never return a bit number
bigger then the bit field size.  In the case of a bitfield that doesn't end on
a word boundary, an offset that makes the search start at the last word of the
bit field and the last word doesn't contain any zero/one bits the search is
continued with a call to find_first_bit with a negative size.  The search
normally ends pretty quickly because the words following the bit field contain
a mix of zeros and ones.  But the bit number that is returned in this case is
too big.

To fix this and additional if to check for this case is needed.  To make the
code easier to read I removed the assembler parts from the
find_next_{zero}_bit functions, the C-ified code is as good.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-s390/bitops.h