Skip to content

Commit 13a2e91

Browse files
committed
Kernel: No need to use safe_memcpy() when handling an inode fault
We're copying the inode contents from a stack buffer into a page that we just quick-mapped, so there's no reason for this memcpy() to fail.
1 parent 8264511 commit 13a2e91

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

Kernel/VM/Region.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -562,18 +562,7 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region)
562562
}
563563

564564
u8* dest_ptr = MM.quickmap_page(*vmobject_physical_page_entry);
565-
{
566-
void* fault_at;
567-
if (!safe_memcpy(dest_ptr, page_buffer, PAGE_SIZE, fault_at)) {
568-
if ((u8*)fault_at >= dest_ptr && (u8*)fault_at <= dest_ptr + PAGE_SIZE)
569-
dbgln(" >> inode fault: error copying data to {}/{}, failed at {}",
570-
vmobject_physical_page_entry->paddr(),
571-
VirtualAddress(dest_ptr),
572-
VirtualAddress(fault_at));
573-
else
574-
VERIFY_NOT_REACHED();
575-
}
576-
}
565+
memcpy(dest_ptr, page_buffer, PAGE_SIZE);
577566
MM.unquickmap_page();
578567

579568
remap_vmobject_page(page_index_in_vmobject);

0 commit comments

Comments
 (0)