diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-05-23 02:10:26 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-05-23 02:10:26 +0200 |
commit | de5f5e33f4be031d23477958808d09f9745d437f (patch) | |
tree | 47ae5ac38f398431338e77ed29167f000872195b /ext2fs | |
parent | cfde657333594c0c0f63760027629e5a5f9f3bfe (diff) |
Fix find_next_zero_bit when no bit is available
* ext2fs/bitmap.c (find_next_zero_bit): Check whether TMP has a bit set before
calling ffz.
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/bitmap.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext2fs/bitmap.c b/ext2fs/bitmap.c index e512d011..92850232 100644 --- a/ext2fs/bitmap.c +++ b/ext2fs/bitmap.c @@ -91,6 +91,8 @@ find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) found_first: tmp |= ~0UL << size; + if (!~tmp) + return result + size; found_middle: return result + ffz(tmp); } |