Refactor validate_user_string to remove unnecessary variable to track length of str
This commit is contained in:
@@ -446,13 +446,12 @@ validate_user_string (const char *str)
|
||||
if (str == NULL || !is_user_vaddr (str))
|
||||
syscall_exit (EXIT_FAILURE);
|
||||
|
||||
size_t length = 0;
|
||||
size_t offset = (uintptr_t) str % PGSIZE;
|
||||
|
||||
/* We move page by page, checking if the page is mapped to physical memory. */
|
||||
for (;;)
|
||||
{
|
||||
void *page = pg_round_down (str + length);
|
||||
void *page = pg_round_down (str);
|
||||
|
||||
if (!is_user_vaddr(page) ||
|
||||
pagedir_get_page (thread_current ()->pagedir, page) == NULL)
|
||||
|
||||
Reference in New Issue
Block a user