mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
Kernel: Assert if rounding-up-to-page-size would wrap around to 0
If we try to align a number above 0xfffff000 to the next multiple of the page size (4 KiB), it would wrap around to 0. This is most likely never what we want, so let's assert if that happens.
This commit is contained in:
@@ -68,7 +68,7 @@ RamdiskController::RamdiskController()
|
||||
size_t count = 0;
|
||||
for (auto used_memory_range : MemoryManager::the().used_memory_ranges()) {
|
||||
if (used_memory_range.type == UsedMemoryRangeType::BootModule) {
|
||||
size_t length = PAGE_ROUND_UP(used_memory_range.end.get()) - used_memory_range.start.get();
|
||||
size_t length = page_round_up(used_memory_range.end.get()) - used_memory_range.start.get();
|
||||
auto region = MemoryManager::the().allocate_kernel_region(used_memory_range.start, length, "Ramdisk", Region::Access::Read | Region::Access::Write);
|
||||
m_devices.append(RamdiskDevice::create(*this, move(region), 6, count));
|
||||
count++;
|
||||
|
||||
Reference in New Issue
Block a user