mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
Kernel: Make ContiguousVMObject factory API OOM safe
This commit is contained in:
parent
cb45b2c001
commit
864b1a65e3
Notes:
sideshowbarker
2024-07-18 17:15:26 +09:00
Author: https://github.com/bgianfo
Commit: 864b1a65e3
Pull-request: https://github.com/SerenityOS/serenity/pull/7520
Reviewed-by: https://github.com/supercomputer7
3 changed files with 17 additions and 11 deletions
|
@ -464,7 +464,11 @@ OwnPtr<Region> MemoryManager::allocate_contiguous_kernel_region(size_t size, Str
|
|||
if (!range.has_value())
|
||||
return {};
|
||||
auto vmobject = ContiguousVMObject::create_with_size(size, physical_alignment);
|
||||
return allocate_kernel_region_with_vmobject(range.value(), vmobject, name, access, cacheable);
|
||||
if (!vmobject) {
|
||||
kernel_page_directory().range_allocator().deallocate(range.value());
|
||||
return {};
|
||||
}
|
||||
return allocate_kernel_region_with_vmobject(range.value(), *vmobject, name, access, cacheable);
|
||||
}
|
||||
|
||||
OwnPtr<Region> MemoryManager::allocate_kernel_region(size_t size, StringView name, Region::Access access, AllocationStrategy strategy, Region::Cacheable cacheable)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue