Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm work around an overflow problem in uvm_fault_wire().



details:   https://anonhg.NetBSD.org/src/rev/eb3d7b95929e
branches:  trunk
changeset: 511189:eb3d7b95929e
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Jun 14 05:12:56 2001 +0000

description:
work around an overflow problem in uvm_fault_wire().
from Eduardo Horvath and Simon Burge.

diffstat:

 sys/uvm/uvm_fault.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r 2055d0a31175 -r eb3d7b95929e sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Thu Jun 14 02:45:30 2001 +0000
+++ b/sys/uvm/uvm_fault.c       Thu Jun 14 05:12:56 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.64 2001/06/02 18:09:26 chs Exp $       */
+/*     $NetBSD: uvm_fault.c,v 1.65 2001/06/14 05:12:56 chs Exp $       */
 
 /*
  *
@@ -1798,17 +1798,22 @@
        vm_prot_t access_type;
 {
        vaddr_t va;
-       pmap_t  pmap;
        int error;
 
-       pmap = vm_map_pmap(map);
-
        /*
         * now fault it in a page at a time.   if the fault fails then we have
         * to undo what we have done.   note that in uvm_fault VM_PROT_NONE
         * is replaced with the max protection if fault_type is VM_FAULT_WIRE.
         */
 
+       /*
+        * XXX work around overflowing a vaddr_t.  this prevents us from
+        * wiring the last page in the address space, though.
+        */
+       if (start > end) {
+               return EFAULT;
+       }
+
        for (va = start ; va < end ; va += PAGE_SIZE) {
                error = uvm_fault(map, va, VM_FAULT_WIRE, access_type);
                if (error) {
@@ -1818,7 +1823,6 @@
                        return error;
                }
        }
-
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index