Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm in sys_mincore(), check the return value of uvm_vslo...



details:   https://anonhg.NetBSD.org/src/rev/6d7054da1f87
branches:  trunk
changeset: 519256:6d7054da1f87
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Dec 14 04:21:22 2001 +0000

description:
in sys_mincore(), check the return value of uvm_vslock() to determine
if the vec pointer is valid rather than using uvm_useracc().
uvm_useracc() just tells you if the permissions of a user mapping allow
the desired access, not whether faulting on that mapping will succeed.

diffstat:

 sys/uvm/uvm_mmap.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r b84151a8080a -r 6d7054da1f87 sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c        Fri Dec 14 01:15:08 2001 +0000
+++ b/sys/uvm/uvm_mmap.c        Fri Dec 14 04:21:22 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_mmap.c,v 1.61 2001/11/25 06:42:47 chs Exp $        */
+/*     $NetBSD: uvm_mmap.c,v 1.62 2001/12/14 04:21:22 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.61 2001/11/25 06:42:47 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.62 2001/12/14 04:21:22 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,17 +158,16 @@
        if (end <= start)
                return (EINVAL);
 
-       npgs = len >> PAGE_SHIFT;
-
-       if (uvm_useracc(vec, npgs, B_WRITE) == FALSE)
-               return (EFAULT);
-
        /*
         * Lock down vec, so our returned status isn't outdated by
         * storing the status byte for a page.
         */
 
-       uvm_vslock(p, vec, npgs, VM_PROT_WRITE);
+       npgs = len >> PAGE_SHIFT;
+       error = uvm_vslock(p, vec, npgs, VM_PROT_WRITE);
+       if (error) {
+               return error;
+       }
        vm_map_lock_read(map);
 
        if (uvm_map_lookup_entry(map, start, &entry) == FALSE) {



Home | Main Index | Thread Index | Old Index