소스 검색

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.)
Andreas Kling 3 년 전
부모
커밋
ec4b814c9a
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      Kernel/FileSystem/InodeFile.cpp

+ 2 - 1
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