Update validate_user_pointer to start from the beginning of the page rather than the given ptr

This commit is contained in:
sBubshait
2024-11-15 13:49:58 +00:00
parent 1c757ecdfe
commit 82d45880f7

View File

@@ -475,7 +475,7 @@ validate_user_pointer (const void *start, size_t size)
/* We now need to check if the entire memory block is mapped to physical
memory by the page table. */
for (const void *ptr = start; ptr <= end; ptr += PGSIZE)
for (const void *ptr = pg_round_down (start); ptr <= end; ptr += PGSIZE)
if (pagedir_get_page (thread_current ()->pagedir, ptr) == NULL)
syscall_exit (EXIT_FAILURE);
}