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.
This commit is contained in:
Mike Smith 2000-04-04 21:00:39 +00:00
parent 8d9f1945b9
commit e36bc62387

View File

@ -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;