summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index e7499d5..0b300c2 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
- * $Id: kern_malloc.c,v 1.54 1999/01/27 21:49:56 dillon Exp $
+ * $Id: kern_malloc.c,v 1.55 1999/05/06 18:12:42 peter Exp $
*/
#include "opt_vm.h"
@@ -138,9 +138,8 @@ malloc(size, type, flags)
s = splmem();
- if (!type->ks_next) {
+ if (type->ks_limit == 0)
malloc_init(type);
- }
indx = BUCKETINDX(size);
kbp = &bucket[indx];
@@ -283,7 +282,7 @@ free(addr, type)
#endif
register struct malloc_type *ksp = type;
- if (!type->ks_next)
+ if (type->ks_limit == 0)
panic("freeing with unknown type (%s)", type->ks_shortdesc);
KASSERT(kmembase <= (char *)addr && (char *)addr < kmemlimit,
@@ -466,7 +465,7 @@ malloc_init(data)
if (type->ks_magic != M_MAGIC)
panic("malloc type lacks magic");
- if (type->ks_next)
+ if (type->ks_limit != 0)
return;
if (cnt.v_page_count == 0)
@@ -494,6 +493,9 @@ malloc_uninit(data)
if (cnt.v_page_count == 0)
panic("malloc_uninit not allowed before vm init");
+ if (type->ks_limit == 0)
+ panic("malloc_uninit on uninitialized type");
+
if (type == kmemstatistics)
kmemstatistics = type->ks_next;
else {
@@ -504,4 +506,6 @@ malloc_uninit(data)
}
}
}
+ type->ks_next = NULL;
+ type->ks_limit = 0;
}
OpenPOWER on IntegriCloud