diff options
author | sotech117 <michael_foiani@brown.edu> | 2024-05-13 12:10:55 +0000 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2024-05-13 12:10:55 +0000 |
commit | 7585cb5ad84babe9db8c6595de464e33fb878f0c (patch) | |
tree | 3acdd29920420ca341ea7e3f90d60b16c384ce51 /kernel/vm/mmap.c | |
parent | f09878f6327426631d9419d825a4e8396e3b9dc4 (diff) |
s5 fixes and issues with weenix
Diffstat (limited to 'kernel/vm/mmap.c')
-rw-r--r-- | kernel/vm/mmap.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/vm/mmap.c b/kernel/vm/mmap.c index 78aa3b5..ce932de 100644 --- a/kernel/vm/mmap.c +++ b/kernel/vm/mmap.c @@ -161,7 +161,6 @@ long do_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off, VMMAP_DIR_HILO, &vma ); - // check if vmmap_map() failed if (err < 0) { @@ -213,7 +212,7 @@ long do_munmap(void *addr, size_t len) } // Check if len is in bounds - if (len > USER_MEM_HIGH) + if (len > USER_MEM_HIGH || len == 0) { return -EINVAL; } @@ -224,17 +223,13 @@ long do_munmap(void *addr, size_t len) return -EINVAL; } - // Check if len is 0 - if (len == 0) - { - return -EINVAL; - } - // Remove the mapping + size_t start = ADDR_TO_PN(addr); + size_t end = ADDR_TO_PN(PAGE_ALIGN_UP((uintptr_t)addr + len)); long ret = vmmap_remove( curproc->p_vmmap, - ADDR_TO_PN(addr), - ADDR_TO_PN(PAGE_ALIGN_UP((uintptr_t)addr + len)) + start, + end - start ); return ret; }
\ No newline at end of file |