summaryrefslogtreecommitdiff
path: root/ext2fs/bitmap.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-05-23 02:10:26 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-05-23 02:10:26 +0200
commitde5f5e33f4be031d23477958808d09f9745d437f (patch)
tree47ae5ac38f398431338e77ed29167f000872195b /ext2fs/bitmap.c
parentcfde657333594c0c0f63760027629e5a5f9f3bfe (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/bitmap.c')
-rw-r--r--ext2fs/bitmap.c2
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);
}