pmm: Fix bug with memmap_alloc_range() where the type of the new upper entry was incorrectly set

This commit is contained in:
mintsuki 2021-03-17 17:56:36 +01:00
parent 3212155564
commit e374d73265
1 changed files with 2 additions and 1 deletions

View File

@ -438,6 +438,7 @@ bool memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type, bool free
uint64_t entry_base = memmap[i].base;
uint64_t entry_top = memmap[i].base + memmap[i].length;
uint32_t entry_type = memmap[i].type;
if (base >= entry_base && base < entry_top &&
top >= entry_base && top <= entry_top) {
@ -464,7 +465,7 @@ bool memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type, bool free
target = &memmap[memmap_entries++];
target->type = memmap[i].type;
target->type = entry_type;
target->base = top;
target->length = entry_top - top;
}