Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm mprotect()'s "len" is really a size_t, and we can't ...



details:   https://anonhg.NetBSD.org/src/rev/e2a03be894bb
branches:  trunk
changeset: 550881:e2a03be894bb
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Aug 24 16:32:50 2003 +0000

description:
mprotect()'s "len" is really a size_t, and we can't do any useful
bounds-checking on it.

diffstat:

 sys/uvm/uvm_mmap.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 37fef38d980e -r e2a03be894bb sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c        Sun Aug 24 15:19:46 2003 +0000
+++ b/sys/uvm/uvm_mmap.c        Sun Aug 24 16:32:50 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_mmap.c,v 1.75 2003/07/06 16:19:18 christos Exp $   */
+/*     $NetBSD: uvm_mmap.c,v 1.76 2003/08/24 16:32:50 chs Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.75 2003/07/06 16:19:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.76 2003/08/24 16:32:50 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -688,7 +688,7 @@
 {
        struct sys_mprotect_args /* {
                syscallarg(caddr_t) addr;
-               syscallarg(int) len;
+               syscallarg(size_t) len;
                syscallarg(int) prot;
        } */ *uap = v;
        struct proc *p = l->l_proc;
@@ -712,10 +712,8 @@
        pageoff = (addr & PAGE_MASK);
        addr -= pageoff;
        size += pageoff;
-       size = (vsize_t)round_page(size);
+       size = round_page(size);
 
-       if ((int)size < 0)
-               return (EINVAL);
        error = uvm_map_protect(&p->p_vmspace->vm_map, addr, addr + size, prot,
                                FALSE);
        return error;



Home | Main Index | Thread Index | Old Index