Fixed another bad bug in the block allocator: the size of the last block

of the block bitmap could be computed wrong - this could cause all sorts
of errors like: overwriting data, creating the "new_vnode with different
cookie" problem, etc.
Should really be the last bug in that piece of code ;-P


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3331 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-05-26 01:50:34 +00:00
parent e1d37632bb
commit 6ac535c5c5

View File

@ -99,7 +99,7 @@ AllocationBlock::SetTo(AllocationGroup &group, uint16 block)
// 8 blocks per byte
fNumBits = fVolume->BlockSize() << 3;
// the last group may have less bits in the last block
if (block * fNumBits > group.fNumBits)
if ((block + 1) * fNumBits > group.fNumBits)
fNumBits = group.fNumBits % fNumBits;
return CachedBlock::SetTo(group.fStart + block) != NULL ? B_OK : B_ERROR;