From: Ben Pfaff Date: Wed, 20 Oct 2004 06:12:36 +0000 (+0000) Subject: Fix bug in pagedir_get_page(): didn't apply uaddr page offset to kaddr X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2e63e6e7f14d2ce25791aeff2ef592a4cd51663;p=pintos-anon Fix bug in pagedir_get_page(): didn't apply uaddr page offset to kaddr return value (!) --- diff --git a/src/userprog/pagedir.c b/src/userprog/pagedir.c index fa8f244..937f433 100644 --- a/src/userprog/pagedir.c +++ b/src/userprog/pagedir.c @@ -121,7 +121,9 @@ void * pagedir_get_page (uint32_t *pd, const void *uaddr) { uint32_t *pte = lookup_page (pd, (void *) uaddr, false); - return pte != NULL && *pte != 0 ? pte_get_page (*pte) : NULL; + return (pte != NULL && *pte != 0 + ? (uint8_t *) pte_get_page (*pte) + pg_ofs (uaddr) + : NULL); } /* Clears any mapping for user virtual address UPAGE in page