diff options
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r-- | sys/kern/kern_malloc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index eb3f62fb99a..dff635d9ce6 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.128 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.129 2017/06/07 13:30:36 mpi Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -164,6 +164,9 @@ malloc(size_t size, int type, int flags) panic("malloc: bogus type %d", type); #endif + if (!cold) + KERNEL_ASSERT_LOCKED(); + KASSERT(flags & (M_WAITOK | M_NOWAIT)); if ((flags & M_NOWAIT) == 0) { @@ -366,6 +369,9 @@ free(void *addr, int type, size_t freedsize) struct kmemstats *ksp = &kmemstats[type]; #endif + if (!cold) + KERNEL_ASSERT_LOCKED(); + if (addr == NULL) return; |