diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-07 16:52:02 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-07 22:16:25 +0200 |
commit | ec4b814c9a1bd103659799a01102d5db3dfca930 (patch) | |
tree | 7eae180ae1cc7137c3feefd59e4a54d52e7e1d4e /Kernel | |
parent | 1a28fc3cb5e56a51f63b81b2e31dc3d9a92ec5b6 (diff) | |
download | serenity-ec4b814c9a1bd103659799a01102d5db3dfca930.zip |
Kernel: Use OOM-safe absolute path serialization in InodeFile::mmap()
Switch from OpenFileDescription::absolute_path() to the OOM-safe
try_serialize_absolute_path() (and propagate any errors to the caller.)
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/FileSystem/InodeFile.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp index ecbdcaa05a..499dee0b7f 100644 --- a/Kernel/FileSystem/InodeFile.cpp +++ b/Kernel/FileSystem/InodeFile.cpp @@ -89,7 +89,8 @@ KResultOr<Memory::Region*> InodeFile::mmap(Process& process, OpenFileDescription vmobject = TRY(Memory::SharedInodeVMObject::try_create_with_inode(inode())); else 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); + auto path = TRY(description.try_serialize_absolute_path()); + return process.address_space().allocate_region_with_vmobject(range, vmobject.release_nonnull(), offset, path->view(), prot, shared); } String InodeFile::absolute_path(const OpenFileDescription& description) const |