From: Akinobu Mita Date: Mon, 21 Mar 2011 12:32:53 +0000 (-0400) Subject: bfs: fix bitmap size argument to find_first_zero_bit() X-Git-Tag: v2.6.39-rc1~399^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69b195be51620d72956acbf3029adad5765695dc;p=pandora-kernel.git bfs: fix bitmap size argument to find_first_zero_bit() The usage of find_first_zero_bit() in bfs_create() is wrong for two reasons. The bitmap size argument to find_first_zero_bit() is info->si_lasti but the correct bitmap size is info->si_lasti + 1 as info->si_lasti is the last valid index in info->si_imap bitmap. Another problem is that it is impossible to detect that info->si_imap bitmap is full because there is an off-by-one bug in the return value check for find_first_zero_bit(). If no zero bits exist in info->si_imap, find_first_zero_bit() returns info->si_lasti. But the check can't catch it due to the off-by-one. Signed-off-by: Akinobu Mita Acked-by: "Tigran A. Aivazian" Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- Reading git-diff-tree failed