From defc7c56fb93b6b4cafa306edac002a6d3a6b123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 19 Mar 2009 08:55:28 +0000 Subject: [PATCH] * One should not rely on the comma operator being evaluated right-to-left as it was done in SAS/C... (yeah, that was ages ago). This fixes bug #2030. * Also, we should probably check if the area we're about to shrink/remove actually is a reserved area. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29605 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 5e63e86cf4..a8082c76a2 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -1187,8 +1187,12 @@ second_chance: // TODO: it would make sense to start with the biggest of them next = addressSpace->areas; last = NULL; - for (last = NULL; next; next = next->address_space_next, - last = next) { + for (last = NULL; next; next = next->address_space_next) { + if (next->id != RESERVED_AREA_ID) { + last = next; + continue; + } + // TODO: take free space after the reserved area into // account! if (next->base == ROUNDUP(next->base, alignment) @@ -1216,6 +1220,8 @@ second_chance: area->base = next->base + next->size; break; } + + last = next; } } break;