1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

Kernel: Don't crash if unable to map ramdisk inside kernel address space

This commit is contained in:
Jean-Baptiste Boric 2021-04-06 17:15:20 +02:00 committed by Andreas Kling
parent 436ca2491d
commit 346e0f4dac
3 changed files with 9 additions and 6 deletions

View file

@ -70,7 +70,10 @@ RamdiskController::RamdiskController()
if (used_memory_range.type == UsedMemoryRangeType::BootModule) {
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));
if (!region)
dmesgln("RamdiskController: Failed to allocate kernel region of size {}", length);
else
m_devices.append(RamdiskDevice::create(*this, region.release_nonnull(), 6, count));
count++;
}
}