]> Git Repo - linux.git/commit - fs/bfs/dir.c
bfs: fix bitmap size argument to find_first_zero_bit()
authorAkinobu Mita <[email protected]>
Mon, 21 Mar 2011 12:32:53 +0000 (08:32 -0400)
committerAl Viro <[email protected]>
Mon, 21 Mar 2011 12:35:12 +0000 (08:35 -0400)
commit69b195be51620d72956acbf3029adad5765695dc
tree343d1786cf00b9d74f6ea7f5d5590c3bb7656180
parentc212f9aaf9101a037fb7f59e75e639437e11d758
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 <[email protected]>
Acked-by: "Tigran A. Aivazian" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
fs/bfs/dir.c
This page took 0.053782 seconds and 4 git commands to generate.