mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
MemoryManager: Off-by-one error when collecting memory pages.
Notice that we ensured that the size is a multiple of the page size and that there is at least one page there, otherwise, this change would be invalid. We create an empty region and then expand it: // First iteration. m_user_physical_regions.append(PhysicalRegion::create(addr, addr)); // Following iterations. region->expand(region->lower(), addr); So if the memory region only has one page, we would end up with an empty region. Thus we need to do one more iteration.
This commit is contained in:
parent
f68ed6d25b
commit
71fd54f76b
Notes:
sideshowbarker
2024-07-19 01:56:04 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/71fd54f76b6 Pull-request: https://github.com/SerenityOS/serenity/pull/3742
1 changed files with 1 additions and 1 deletions
|
@ -151,7 +151,7 @@ void MemoryManager::parse_memory_map()
|
|||
klog() << "MM: considering memory at " << String::format("%p", (FlatPtr)mmap->addr) << " - " << String::format("%p", (FlatPtr)(mmap->addr + mmap->len));
|
||||
#endif
|
||||
|
||||
for (size_t page_base = mmap->addr; page_base < (mmap->addr + mmap->len); page_base += PAGE_SIZE) {
|
||||
for (size_t page_base = mmap->addr; page_base <= (mmap->addr + mmap->len); page_base += PAGE_SIZE) {
|
||||
auto addr = PhysicalAddress(page_base);
|
||||
|
||||
if (addr.get() < used_range_end.get() && addr.get() >= used_range_start.get())
|
||||
|
|
Loading…
Reference in a new issue