Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm In uvm_km_kmemalloc(), use the correct size for the ...



details:   https://anonhg.NetBSD.org/src/rev/30acfd42b6e7
branches:  trunk
changeset: 508531:30acfd42b6e7
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Apr 12 21:08:25 2001 +0000

description:
In uvm_km_kmemalloc(), use the correct size for the uvm_unmap()
call if the allocation fails.

Problem pointed out by Alfred Perlstein <bright%wintelcom.net@localhost>,
who found a similar bug in FreeBSD.

diffstat:

 sys/uvm/uvm_km.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 55f62ab39a3c -r 30acfd42b6e7 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Thu Apr 12 20:38:25 2001 +0000
+++ b/sys/uvm/uvm_km.c  Thu Apr 12 21:08:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_km.c,v 1.43 2001/03/15 06:10:57 chs Exp $  */
+/*     $NetBSD: uvm_km.c,v 1.44 2001/04/12 21:08:25 thorpej Exp $      */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -489,6 +489,7 @@
 {
        vaddr_t kva, loopva;
        vaddr_t offset;
+       vsize_t loopsize;
        struct vm_page *pg;
        UVMHIST_FUNC("uvm_km_kmemalloc"); UVMHIST_CALLED(maphist);
 
@@ -537,7 +538,8 @@
         */
 
        loopva = kva;
-       while (size) {
+       loopsize = size;
+       while (loopsize) {
                simple_lock(&obj->vmobjlock);
                pg = uvm_pagealloc(obj, offset, NULL, 0);
                if (pg) {
@@ -578,7 +580,7 @@
                }
                loopva += PAGE_SIZE;
                offset += PAGE_SIZE;
-               size -= PAGE_SIZE;
+               loopsize -= PAGE_SIZE;
        }
        UVMHIST_LOG(maphist,"<- done (kva=0x%x)", kva,0,0,0);
        return(kva);



Home | Main Index | Thread Index | Old Index