VMAnonymousCache: Fix off by one in page freeing on resize.

The pageIndex is incremented on loop, so rounding up to the next swap
block would skip the first entry of the next block which would leak its
swap slot.

Change-Id: Ief3d29e711d323756034ea5ba6e300c489198aff
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2583
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Michael Lotz 2020-05-05 02:30:28 +02:00 committed by waddlesplash
parent 1702afeb88
commit 315a581cd6

View File

@ -503,7 +503,7 @@ VMAnonymousCache::_FreeSwapPageRange(off_t fromOffset, off_t toOffset)
swapBlock = sSwapHashTable.Lookup(key);
if (swapBlock == NULL) {
pageIndex = ROUNDUP(pageIndex + 1, SWAP_BLOCK_PAGES);
pageIndex = ROUNDUP(pageIndex + 1, SWAP_BLOCK_PAGES) - 1;
continue;
}
}