From de5f5e33f4be031d23477958808d09f9745d437f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 23 May 2012 02:10:26 +0200 Subject: 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. --- ext2fs/bitmap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ext2fs') 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); } -- cgit v1.2.3