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

Kernel: Use KResultOr and TRY() for {Shared,Private}InodeVMObject

This commit is contained in:
Andreas Kling 2021-09-06 12:58:03 +02:00
parent e3a716ceff
commit 6e3381ac32
8 changed files with 14 additions and 31 deletions

View file

@ -86,11 +86,9 @@ KResultOr<Memory::Region*> InodeFile::mmap(Process& process, FileDescription& de
// FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec.
RefPtr<Memory::InodeVMObject> vmobject;
if (shared)
vmobject = Memory::SharedInodeVMObject::try_create_with_inode(inode());
vmobject = TRY(Memory::SharedInodeVMObject::try_create_with_inode(inode()));
else
vmobject = Memory::PrivateInodeVMObject::try_create_with_inode(inode());
if (!vmobject)
return ENOMEM;
vmobject = TRY(Memory::PrivateInodeVMObject::try_create_with_inode(inode()));
return process.address_space().allocate_region_with_vmobject(range, vmobject.release_nonnull(), offset, description.absolute_path(), prot, shared);
}