summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-11 17:55:29 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-11 17:55:29 +0200
commit88d490566ff78fef4e4849d1db9857d3a81fd29e (patch)
treeddfbc047549707dc9f2e4a216a69040ebd564da1
parentaf8c74a328b80b09a6e948ab2e9dc4e54ad91cec (diff)
downloadserenity-88d490566ff78fef4e4849d1db9857d3a81fd29e.zip
Kernel: Rename various *VMObject::create*() => try_create()
try_*() implies that it can fail (and they all return RefPtr with nullptr signalling failure.)
-rw-r--r--Kernel/Bus/USB/UHCIController.cpp6
-rw-r--r--Kernel/Bus/USB/USBTransfer.cpp2
-rw-r--r--Kernel/Devices/MemoryDevice.cpp2
-rw-r--r--Kernel/Devices/SB16.cpp2
-rw-r--r--Kernel/FileSystem/InodeFile.cpp2
-rw-r--r--Kernel/Graphics/FramebufferDevice.cpp10
-rw-r--r--Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp2
-rw-r--r--Kernel/Syscalls/anon_create.cpp2
-rw-r--r--Kernel/Syscalls/mmap.cpp2
-rw-r--r--Kernel/Syscalls/ptrace.cpp2
-rw-r--r--Kernel/VM/AnonymousVMObject.cpp10
-rw-r--r--Kernel/VM/AnonymousVMObject.h8
-rw-r--r--Kernel/VM/ContiguousVMObject.cpp2
-rw-r--r--Kernel/VM/ContiguousVMObject.h2
-rw-r--r--Kernel/VM/MemoryManager.cpp8
-rw-r--r--Kernel/VM/PrivateInodeVMObject.cpp2
-rw-r--r--Kernel/VM/PrivateInodeVMObject.h2
-rw-r--r--Kernel/VM/ScatterGatherList.cpp2
-rw-r--r--Kernel/VM/Space.cpp2
19 files changed, 35 insertions, 35 deletions
diff --git a/Kernel/Bus/USB/UHCIController.cpp b/Kernel/Bus/USB/UHCIController.cpp
index 2d1ebbe290..2bc3a57b08 100644
--- a/Kernel/Bus/USB/UHCIController.cpp
+++ b/Kernel/Bus/USB/UHCIController.cpp
@@ -287,7 +287,7 @@ void UHCIController::reset()
}
// Let's allocate the physical page for the Frame List (which is 4KiB aligned)
- auto framelist_vmobj = ContiguousVMObject::create_with_size(PAGE_SIZE);
+ auto framelist_vmobj = ContiguousVMObject::try_create_with_size(PAGE_SIZE);
m_framelist = MemoryManager::the().allocate_kernel_region_with_vmobject(*framelist_vmobj, PAGE_SIZE, "UHCI Framelist", Region::Access::Write);
dbgln("UHCI: Allocated framelist at physical address {}", m_framelist->physical_page(0)->paddr());
dbgln("UHCI: Framelist is at virtual address {}", m_framelist->vaddr());
@@ -309,7 +309,7 @@ UNMAP_AFTER_INIT void UHCIController::create_structures()
{
// Let's allocate memory for both the QH and TD pools
// First the QH pool and all of the Interrupt QH's
- auto qh_pool_vmobject = ContiguousVMObject::create_with_size(2 * PAGE_SIZE);
+ auto qh_pool_vmobject = ContiguousVMObject::try_create_with_size(2 * PAGE_SIZE);
m_qh_pool = MemoryManager::the().allocate_kernel_region_with_vmobject(*qh_pool_vmobject, 2 * PAGE_SIZE, "UHCI Queue Head Pool", Region::Access::Write);
memset(m_qh_pool->vaddr().as_ptr(), 0, 2 * PAGE_SIZE); // Zero out both pages
@@ -329,7 +329,7 @@ UNMAP_AFTER_INIT void UHCIController::create_structures()
m_dummy_qh = allocate_queue_head();
// Now the Transfer Descriptor pool
- auto td_pool_vmobject = ContiguousVMObject::create_with_size(2 * PAGE_SIZE);
+ auto td_pool_vmobject = ContiguousVMObject::try_create_with_size(2 * PAGE_SIZE);
m_td_pool = MemoryManager::the().allocate_kernel_region_with_vmobject(*td_pool_vmobject, 2 * PAGE_SIZE, "UHCI Transfer Descriptor Pool", Region::Access::Write);
memset(m_td_pool->vaddr().as_ptr(), 0, 2 * PAGE_SIZE);
diff --git a/Kernel/Bus/USB/USBTransfer.cpp b/Kernel/Bus/USB/USBTransfer.cpp
index ec67d331c8..34f4b64333 100644
--- a/Kernel/Bus/USB/USBTransfer.cpp
+++ b/Kernel/Bus/USB/USBTransfer.cpp
@@ -11,7 +11,7 @@ namespace Kernel::USB {
RefPtr<Transfer> Transfer::try_create(Pipe& pipe, u16 len)
{
- auto vmobject = ContiguousVMObject::create_with_size(PAGE_SIZE);
+ auto vmobject = ContiguousVMObject::try_create_with_size(PAGE_SIZE);
if (!vmobject)
return nullptr;
diff --git a/Kernel/Devices/MemoryDevice.cpp b/Kernel/Devices/MemoryDevice.cpp
index 6955a6dc34..2860983610 100644
--- a/Kernel/Devices/MemoryDevice.cpp
+++ b/Kernel/Devices/MemoryDevice.cpp
@@ -49,7 +49,7 @@ KResultOr<Region*> MemoryDevice::mmap(Process& process, FileDescription&, const
return EINVAL;
}
- auto vmobject = AnonymousVMObject::create_for_physical_range(viewed_address, range.size());
+ auto vmobject = AnonymousVMObject::try_create_for_physical_range(viewed_address, range.size());
if (!vmobject)
return ENOMEM;
dbgln("MemoryDevice: Mapped physical memory at {} for range of {} bytes", viewed_address, range.size());
diff --git a/Kernel/Devices/SB16.cpp b/Kernel/Devices/SB16.cpp
index 81a3ea3934..3e4a9cc705 100644
--- a/Kernel/Devices/SB16.cpp
+++ b/Kernel/Devices/SB16.cpp
@@ -237,7 +237,7 @@ KResultOr<size_t> SB16::write(FileDescription&, u64, const UserOrKernelBuffer& d
auto page = MM.allocate_supervisor_physical_page();
if (!page)
return ENOMEM;
- auto vmobject = AnonymousVMObject::create_with_physical_page(*page);
+ auto vmobject = AnonymousVMObject::try_create_with_physical_page(*page);
if (!vmobject)
return ENOMEM;
m_dma_region = MM.allocate_kernel_region_with_vmobject(*vmobject, PAGE_SIZE, "SB16 DMA buffer", Region::Access::Write);
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index ed051a7416..6a6a34d956 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -99,7 +99,7 @@ KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& descriptio
if (shared)
vmobject = SharedInodeVMObject::try_create_with_inode(inode());
else
- vmobject = PrivateInodeVMObject::create_with_inode(inode());
+ vmobject = PrivateInodeVMObject::try_create_with_inode(inode());
if (!vmobject)
return ENOMEM;
return process.space().allocate_region_with_vmobject(range, vmobject.release_nonnull(), offset, description.absolute_path(), prot, shared);
diff --git a/Kernel/Graphics/FramebufferDevice.cpp b/Kernel/Graphics/FramebufferDevice.cpp
index 15672485aa..752e8b7610 100644
--- a/Kernel/Graphics/FramebufferDevice.cpp
+++ b/Kernel/Graphics/FramebufferDevice.cpp
@@ -39,13 +39,13 @@ KResultOr<Region*> FramebufferDevice::mmap(Process& process, FileDescription&, c
if (range.size() != page_round_up(framebuffer_size_in_bytes()))
return EOVERFLOW;
- auto vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
+ auto vmobject = AnonymousVMObject::try_create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
if (!vmobject)
return ENOMEM;
m_userspace_real_framebuffer_vmobject = vmobject;
- m_real_framebuffer_vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
- m_swapped_framebuffer_vmobject = AnonymousVMObject::create_with_size(page_round_up(framebuffer_size_in_bytes()), AllocationStrategy::AllocateNow);
+ m_real_framebuffer_vmobject = AnonymousVMObject::try_create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
+ m_swapped_framebuffer_vmobject = AnonymousVMObject::try_create_with_size(page_round_up(framebuffer_size_in_bytes()), AllocationStrategy::AllocateNow);
m_real_framebuffer_region = MM.allocate_kernel_region_with_vmobject(*m_real_framebuffer_vmobject, page_round_up(framebuffer_size_in_bytes()), "Framebuffer", Region::Access::Read | Region::Access::Write);
m_swapped_framebuffer_region = MM.allocate_kernel_region_with_vmobject(*m_swapped_framebuffer_vmobject, page_round_up(framebuffer_size_in_bytes()), "Framebuffer Swap (Blank)", Region::Access::Read | Region::Access::Write);
@@ -101,11 +101,11 @@ String FramebufferDevice::device_name() const
UNMAP_AFTER_INIT void FramebufferDevice::initialize()
{
- m_real_framebuffer_vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
+ m_real_framebuffer_vmobject = AnonymousVMObject::try_create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
VERIFY(m_real_framebuffer_vmobject);
m_real_framebuffer_region = MM.allocate_kernel_region_with_vmobject(*m_real_framebuffer_vmobject, page_round_up(framebuffer_size_in_bytes()), "Framebuffer", Region::Access::Read | Region::Access::Write);
VERIFY(m_real_framebuffer_region);
- m_swapped_framebuffer_vmobject = AnonymousVMObject::create_with_size(page_round_up(framebuffer_size_in_bytes()), AllocationStrategy::AllocateNow);
+ m_swapped_framebuffer_vmobject = AnonymousVMObject::try_create_with_size(page_round_up(framebuffer_size_in_bytes()), AllocationStrategy::AllocateNow);
VERIFY(m_swapped_framebuffer_vmobject);
m_swapped_framebuffer_region = MM.allocate_kernel_region_with_vmobject(*m_swapped_framebuffer_vmobject, page_round_up(framebuffer_size_in_bytes()), "Framebuffer Swap (Blank)", Region::Access::Read | Region::Access::Write);
VERIFY(m_swapped_framebuffer_region);
diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
index 11dd307d15..4b0ab639c3 100644
--- a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
+++ b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
@@ -40,7 +40,7 @@ void VirtIOFrameBufferDevice::create_framebuffer()
for (auto i = 0u; i < num_needed_pages; ++i) {
pages.append(write_sink_page);
}
- m_framebuffer_sink_vmobject = AnonymousVMObject::create_with_physical_pages(move(pages));
+ m_framebuffer_sink_vmobject = AnonymousVMObject::try_create_with_physical_pages(move(pages));
Locker locker(m_gpu.operation_lock());
m_current_buffer = &buffer_from_index(m_last_set_buffer_index.load());
diff --git a/Kernel/Syscalls/anon_create.cpp b/Kernel/Syscalls/anon_create.cpp
index a0c57da8b7..7c95d9e1ac 100644
--- a/Kernel/Syscalls/anon_create.cpp
+++ b/Kernel/Syscalls/anon_create.cpp
@@ -28,7 +28,7 @@ KResultOr<FlatPtr> Process::sys$anon_create(size_t size, int options)
if (new_fd < 0)
return new_fd;
- auto vmobject = AnonymousVMObject::create_with_size(size, AllocationStrategy::Reserve);
+ auto vmobject = AnonymousVMObject::try_create_with_size(size, AllocationStrategy::Reserve);
if (!vmobject)
return ENOMEM;
diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp
index cc6cc1fa1f..83fdd5f5c1 100644
--- a/Kernel/Syscalls/mmap.cpp
+++ b/Kernel/Syscalls/mmap.cpp
@@ -542,7 +542,7 @@ KResultOr<FlatPtr> Process::sys$mremap(Userspace<const Syscall::SC_mremap_params
auto old_offset = old_region->offset_in_vmobject();
NonnullRefPtr inode = static_cast<SharedInodeVMObject&>(old_region->vmobject()).inode();
- auto new_vmobject = PrivateInodeVMObject::create_with_inode(inode);
+ auto new_vmobject = PrivateInodeVMObject::try_create_with_inode(inode);
if (!new_vmobject)
return ENOMEM;
diff --git a/Kernel/Syscalls/ptrace.cpp b/Kernel/Syscalls/ptrace.cpp
index ecdeb4b1d3..7ce4bab1f6 100644
--- a/Kernel/Syscalls/ptrace.cpp
+++ b/Kernel/Syscalls/ptrace.cpp
@@ -201,7 +201,7 @@ KResult Process::poke_user_data(Userspace<u32*> address, u32 data)
// If the region is shared, we change its vmobject to a PrivateInodeVMObject
// to prevent the write operation from changing any shared inode data
VERIFY(region->vmobject().is_shared_inode());
- auto vmobject = PrivateInodeVMObject::create_with_inode(static_cast<SharedInodeVMObject&>(region->vmobject()).inode());
+ auto vmobject = PrivateInodeVMObject::try_create_with_inode(static_cast<SharedInodeVMObject&>(region->vmobject()).inode());
if (!vmobject)
return ENOMEM;
region->set_vmobject(vmobject.release_nonnull());
diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp
index 01cd64ae51..4f43684f96 100644
--- a/Kernel/VM/AnonymousVMObject.cpp
+++ b/Kernel/VM/AnonymousVMObject.cpp
@@ -55,7 +55,7 @@ RefPtr<VMObject> AnonymousVMObject::clone()
return adopt_ref_if_nonnull(new (nothrow) AnonymousVMObject(*this));
}
-RefPtr<AnonymousVMObject> AnonymousVMObject::create_with_size(size_t size, AllocationStrategy commit)
+RefPtr<AnonymousVMObject> AnonymousVMObject::try_create_with_size(size_t size, AllocationStrategy commit)
{
if (commit == AllocationStrategy::Reserve || commit == AllocationStrategy::AllocateNow) {
// We need to attempt to commit before actually creating the object
@@ -65,20 +65,20 @@ RefPtr<AnonymousVMObject> AnonymousVMObject::create_with_size(size_t size, Alloc
return adopt_ref_if_nonnull(new (nothrow) AnonymousVMObject(size, commit));
}
-RefPtr<AnonymousVMObject> AnonymousVMObject::create_with_physical_pages(NonnullRefPtrVector<PhysicalPage> physical_pages)
+RefPtr<AnonymousVMObject> AnonymousVMObject::try_create_with_physical_pages(NonnullRefPtrVector<PhysicalPage> physical_pages)
{
return adopt_ref_if_nonnull(new (nothrow) AnonymousVMObject(physical_pages));
}
-RefPtr<AnonymousVMObject> AnonymousVMObject::create_with_physical_page(PhysicalPage& page)
+RefPtr<AnonymousVMObject> AnonymousVMObject::try_create_with_physical_page(PhysicalPage& page)
{
return adopt_ref_if_nonnull(new (nothrow) AnonymousVMObject(page));
}
-RefPtr<AnonymousVMObject> AnonymousVMObject::create_for_physical_range(PhysicalAddress paddr, size_t size)
+RefPtr<AnonymousVMObject> AnonymousVMObject::try_create_for_physical_range(PhysicalAddress paddr, size_t size)
{
if (paddr.offset(size) < paddr) {
- dbgln("Shenanigans! create_for_physical_range({}, {}) would wrap around", paddr, size);
+ dbgln("Shenanigans! try_create_for_physical_range({}, {}) would wrap around", paddr, size);
return nullptr;
}
return adopt_ref_if_nonnull(new (nothrow) AnonymousVMObject(paddr, size));
diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h
index fdfb94c3e1..e36ba2a6a7 100644
--- a/Kernel/VM/AnonymousVMObject.h
+++ b/Kernel/VM/AnonymousVMObject.h
@@ -21,10 +21,10 @@ class AnonymousVMObject final : public VMObject {
public:
virtual ~AnonymousVMObject() override;
- static RefPtr<AnonymousVMObject> create_with_size(size_t, AllocationStrategy);
- static RefPtr<AnonymousVMObject> create_for_physical_range(PhysicalAddress paddr, size_t size);
- static RefPtr<AnonymousVMObject> create_with_physical_page(PhysicalPage& page);
- static RefPtr<AnonymousVMObject> create_with_physical_pages(NonnullRefPtrVector<PhysicalPage>);
+ static RefPtr<AnonymousVMObject> try_create_with_size(size_t, AllocationStrategy);
+ static RefPtr<AnonymousVMObject> try_create_for_physical_range(PhysicalAddress paddr, size_t size);
+ static RefPtr<AnonymousVMObject> try_create_with_physical_page(PhysicalPage& page);
+ static RefPtr<AnonymousVMObject> try_create_with_physical_pages(NonnullRefPtrVector<PhysicalPage>);
virtual RefPtr<VMObject> clone() override;
RefPtr<PhysicalPage> allocate_committed_page(size_t);
diff --git a/Kernel/VM/ContiguousVMObject.cpp b/Kernel/VM/ContiguousVMObject.cpp
index 96f5a63368..3d9007c05e 100644
--- a/Kernel/VM/ContiguousVMObject.cpp
+++ b/Kernel/VM/ContiguousVMObject.cpp
@@ -10,7 +10,7 @@
namespace Kernel {
-RefPtr<ContiguousVMObject> ContiguousVMObject::create_with_size(size_t size, size_t physical_alignment)
+RefPtr<ContiguousVMObject> ContiguousVMObject::try_create_with_size(size_t size, size_t physical_alignment)
{
auto contiguous_physical_pages = MM.allocate_contiguous_supervisor_physical_pages(size, physical_alignment);
if (contiguous_physical_pages.is_empty())
diff --git a/Kernel/VM/ContiguousVMObject.h b/Kernel/VM/ContiguousVMObject.h
index c6c25ca7df..b97d4f2f0a 100644
--- a/Kernel/VM/ContiguousVMObject.h
+++ b/Kernel/VM/ContiguousVMObject.h
@@ -15,7 +15,7 @@ class ContiguousVMObject final : public VMObject {
public:
virtual ~ContiguousVMObject() override;
- static RefPtr<ContiguousVMObject> create_with_size(size_t, size_t physical_alignment = PAGE_SIZE);
+ static RefPtr<ContiguousVMObject> try_create_with_size(size_t, size_t physical_alignment = PAGE_SIZE);
private:
explicit ContiguousVMObject(size_t, NonnullRefPtrVector<PhysicalPage>&);
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index 613dd2f6c2..ea4f9a6bb0 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -631,7 +631,7 @@ OwnPtr<Region> MemoryManager::allocate_contiguous_kernel_region(size_t size, Str
auto range = kernel_page_directory().range_allocator().allocate_anywhere(size);
if (!range.has_value())
return {};
- auto vmobject = ContiguousVMObject::create_with_size(size, physical_alignment);
+ auto vmobject = ContiguousVMObject::try_create_with_size(size, physical_alignment);
if (!vmobject) {
kernel_page_directory().range_allocator().deallocate(range.value());
return {};
@@ -642,7 +642,7 @@ OwnPtr<Region> MemoryManager::allocate_contiguous_kernel_region(size_t size, Str
OwnPtr<Region> MemoryManager::allocate_kernel_region(size_t size, StringView name, Region::Access access, AllocationStrategy strategy, Region::Cacheable cacheable)
{
VERIFY(!(size % PAGE_SIZE));
- auto vm_object = AnonymousVMObject::create_with_size(size, strategy);
+ auto vm_object = AnonymousVMObject::try_create_with_size(size, strategy);
if (!vm_object)
return {};
ScopedSpinLock lock(s_mm_lock);
@@ -654,7 +654,7 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region(size_t size, StringView nam
OwnPtr<Region> MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable)
{
- auto vm_object = AnonymousVMObject::create_for_physical_range(paddr, size);
+ auto vm_object = AnonymousVMObject::try_create_for_physical_range(paddr, size);
if (!vm_object)
return {};
VERIFY(!(size % PAGE_SIZE));
@@ -667,7 +667,7 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size
OwnPtr<Region> MemoryManager::allocate_kernel_region_identity(PhysicalAddress paddr, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable)
{
- auto vm_object = AnonymousVMObject::create_for_physical_range(paddr, size);
+ auto vm_object = AnonymousVMObject::try_create_for_physical_range(paddr, size);
if (!vm_object)
return {};
VERIFY(!(size % PAGE_SIZE));
diff --git a/Kernel/VM/PrivateInodeVMObject.cpp b/Kernel/VM/PrivateInodeVMObject.cpp
index 5bca30d915..7968475e8d 100644
--- a/Kernel/VM/PrivateInodeVMObject.cpp
+++ b/Kernel/VM/PrivateInodeVMObject.cpp
@@ -9,7 +9,7 @@
namespace Kernel {
-RefPtr<PrivateInodeVMObject> PrivateInodeVMObject::create_with_inode(Inode& inode)
+RefPtr<PrivateInodeVMObject> PrivateInodeVMObject::try_create_with_inode(Inode& inode)
{
return adopt_ref_if_nonnull(new (nothrow) PrivateInodeVMObject(inode, inode.size()));
}
diff --git a/Kernel/VM/PrivateInodeVMObject.h b/Kernel/VM/PrivateInodeVMObject.h
index 616f7ab0b0..25d3a2c290 100644
--- a/Kernel/VM/PrivateInodeVMObject.h
+++ b/Kernel/VM/PrivateInodeVMObject.h
@@ -18,7 +18,7 @@ class PrivateInodeVMObject final : public InodeVMObject {
public:
virtual ~PrivateInodeVMObject() override;
- static RefPtr<PrivateInodeVMObject> create_with_inode(Inode&);
+ static RefPtr<PrivateInodeVMObject> try_create_with_inode(Inode&);
virtual RefPtr<VMObject> clone() override;
private:
diff --git a/Kernel/VM/ScatterGatherList.cpp b/Kernel/VM/ScatterGatherList.cpp
index 031a28518e..aeb2aa9d65 100644
--- a/Kernel/VM/ScatterGatherList.cpp
+++ b/Kernel/VM/ScatterGatherList.cpp
@@ -10,7 +10,7 @@ namespace Kernel {
RefPtr<ScatterGatherList> ScatterGatherList::create(AsyncBlockDeviceRequest& request, NonnullRefPtrVector<PhysicalPage> allocated_pages, size_t device_block_size)
{
- auto vm_object = AnonymousVMObject::create_with_physical_pages(allocated_pages);
+ auto vm_object = AnonymousVMObject::try_create_with_physical_pages(allocated_pages);
if (!vm_object)
return {};
return adopt_ref_if_nonnull(new (nothrow) ScatterGatherList(vm_object.release_nonnull(), request, device_block_size));
diff --git a/Kernel/VM/Space.cpp b/Kernel/VM/Space.cpp
index 8a9ec5cc0e..851bb072a1 100644
--- a/Kernel/VM/Space.cpp
+++ b/Kernel/VM/Space.cpp
@@ -161,7 +161,7 @@ Region& Space::allocate_split_region(const Region& source_region, const Range& r
KResultOr<Region*> Space::allocate_region(Range const& range, StringView name, int prot, AllocationStrategy strategy)
{
VERIFY(range.is_valid());
- auto vmobject = AnonymousVMObject::create_with_size(range.size(), strategy);
+ auto vmobject = AnonymousVMObject::try_create_with_size(range.size(), strategy);
if (!vmobject)
return ENOMEM;
auto region = Region::create_user_accessible(m_process, range, vmobject.release_nonnull(), 0, KString::try_create(name), prot_to_region_access_flags(prot), Region::Cacheable::Yes, false);