Fix Memory Leaks, Synchronisation in Processes, and Refactoring #37

Merged
sb3923 merged 11 commits from task2/system-calls/saleh into system-calls 2024-11-13 18:51:52 +00:00
15 changed files with 205 additions and 66 deletions
Showing only changes of commit 31ea215805 - Show all commits

View File

@@ -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)