vm: fix area insertion logic

* When looking for a place for new area the size of the area to be
   inserted instead of the next area size was used to check whether
   we are already past the upper bound.
 * There was an attempt to insert area even if we were past the
   upper bound.
This commit is contained in:
Pawel Dziepak
2013-05-22 19:31:26 +02:00
parent 07e1875ea2
commit 6c9c8a037c
+3 -3
View File
@@ -588,7 +588,7 @@ second_chance:
} }
// keep walking // keep walking
while (next != NULL && next->Base() + size - 1 <= end) { while (next != NULL && next->Base() + next->Size() - 1 <= end) {
addr_t alignedBase = ROUNDUP(last->Base() + last->Size(), addr_t alignedBase = ROUNDUP(last->Base() + last->Size(),
alignment); alignment);
addr_t nextBase = min_c(end, next->Base() - 1); addr_t nextBase = min_c(end, next->Base() - 1);
@@ -615,8 +615,8 @@ second_chance:
addr_t alignedBase = ROUNDUP(last->Base() + last->Size(), addr_t alignedBase = ROUNDUP(last->Base() + last->Size(),
alignment); alignment);
if (is_valid_spot(last->Base() + (last->Size() - 1), alignedBase, if (next == NULL && is_valid_spot(last->Base() + (last->Size() - 1),
size, end)) { alignedBase, size, end)) {
if (is_randomized(addressSpec)) { if (is_randomized(addressSpec)) {
alignedBase = _RandomizeAddress(alignedBase, end - size + 1, alignedBase = _RandomizeAddress(alignedBase, end - size + 1,