• Martin Schwidefsky's avatar
    [PATCH] s390: find_next_{zero}_bit fixes · afff7e2b
    Martin Schwidefsky authored
    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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    afff7e2b
bitops.h 29.6 KB