From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

mprotect: page-align len parameter instead of returning error

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <20190629040727.9569-1-jwkozac...@gmail.com>

---
diff --git a/libc/mman.cc b/libc/mman.cc
--- a/libc/mman.cc
+++ b/libc/mman.cc
@@ -88,11 +88,12 @@ int mprotect(void *addr, size_t len, int prot)
         abort("mprotect() on linear map not supported\n");
     }

-    if (!mmu::is_page_aligned(addr) || !mmu::is_page_aligned(len)) {
+    if (!mmu::is_page_aligned(addr)) {
         // address not page aligned
         return libc_error(EINVAL);
     }

+    len = align_up(len, mmu::page_size);
     return mmu::mprotect(addr, len, libc_prot_to_perm(prot)).to_libc();
 }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000534025058c8673ff%40google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to