summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_zone.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-04-04 21:00:39 +0000
committermsmith <msmith@FreeBSD.org>2000-04-04 21:00:39 +0000
commit9942d38efa51aa6aa1eff896d00233fa97047309 (patch)
tree9dab0af6dbde7a7a96a3d8b32a06772d4f9a383f /sys/vm/vm_zone.c
parent96e6d0e350ef149f900cade897084746205c4322 (diff)
downloadFreeBSD-src-9942d38efa51aa6aa1eff896d00233fa97047309.zip
FreeBSD-src-9942d38efa51aa6aa1eff896d00233fa97047309.tar.gz
Fix _zget() so that it checks the return from kmem_alloc(), to avoid
zttempting to bzero NULL when the kernel map fills up. _zget() will now return NULL as it seems it was originally intended to do.
Diffstat (limited to 'sys/vm/vm_zone.c')
-rw-r--r--sys/vm/vm_zone.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/vm/vm_zone.c b/sys/vm/vm_zone.c
index b53cfa0..b1007dc 100644
--- a/sys/vm/vm_zone.c
+++ b/sys/vm/vm_zone.c
@@ -334,7 +334,8 @@ _zget(vm_zone_t z)
#ifdef SMP
simple_lock(&z->zlock);
#endif
- zone_kmem_pages += z->zalloc;
+ if (item != NULL)
+ zone_kmem_pages += z->zalloc;
splx(s);
} else {
#ifdef SMP
@@ -344,9 +345,14 @@ _zget(vm_zone_t z)
#ifdef SMP
simple_lock(&z->zlock);
#endif
- zone_kern_pages += z->zalloc;
+ if (item != NULL)
+ zone_kern_pages += z->zalloc;
+ }
+ if (item != NULL) {
+ bzero(item, nbytes);
+ } else {
+ nbytes = 0;
}
- bzero(item, nbytes);
nitems = nbytes / z->zsize;
}
z->ztotal += nitems;
OpenPOWER on IntegriCloud