summaryrefslogtreecommitdiff
path: root/Kernel/Graphics
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-11 19:07:00 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-11 19:09:02 +0200
commitf244a25f71e1d445558aed26a0042714c4add137 (patch)
tree09c8a240f7eb348b197df130393506e0b3a3b644 /Kernel/Graphics
parentd85bce57b3168c792422f8392cfaee098829de94 (diff)
downloadserenity-f244a25f71e1d445558aed26a0042714c4add137.zip
Kernel: Rename VMObject::clone() => try_clone()
And fix an unsafe dereference in SharedInodeVMObject::try_clone() to make it OOM-safe.
Diffstat (limited to 'Kernel/Graphics')
-rw-r--r--Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
index 4b0ab639c3..b5d8be0c75 100644
--- a/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
+++ b/Kernel/Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
@@ -245,7 +245,7 @@ KResultOr<Region*> VirtIOFrameBufferDevice::mmap(Process& process, FileDescripti
if (m_userspace_mmap_region)
return ENOMEM;
- auto vmobject = m_are_writes_active ? m_framebuffer->vmobject().clone() : m_framebuffer_sink_vmobject;
+ auto vmobject = m_are_writes_active ? m_framebuffer->vmobject().try_clone() : m_framebuffer_sink_vmobject;
if (vmobject.is_null())
return ENOMEM;
@@ -267,7 +267,7 @@ void VirtIOFrameBufferDevice::deactivate_writes()
m_are_writes_active = false;
if (m_userspace_mmap_region) {
auto* region = m_userspace_mmap_region.unsafe_ptr();
- auto vm_object = m_framebuffer_sink_vmobject->clone();
+ auto vm_object = m_framebuffer_sink_vmobject->try_clone();
VERIFY(vm_object);
region->set_vmobject(vm_object.release_nonnull());
region->remap();