diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2011-09-22 21:52:37 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2011-09-22 21:52:37 +0000 |
commit | d1243ba8ce6a798b9298f8d2c2cb737608c5c2e8 (patch) | |
tree | b94049f7fe2abc18837a1dfe8746fde2953c5b4b /sys | |
parent | 9c66678aaa3a800a674931d05f16201228ece3f5 (diff) |
Improve kernel malloc type checking.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_malloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index adce9cc787d..d6fc8d3ac20 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.89 2011/06/06 17:10:23 ariane Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.90 2011/09/22 21:52:36 jsing Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -187,7 +187,7 @@ malloc(unsigned long size, int type, int flags) #ifdef KMEMSTATS struct kmemstats *ksp = &kmemstats[type]; - if (((unsigned long)type) >= M_LAST) + if (((unsigned long)type) <= 1 || ((unsigned long)type) >= M_LAST) panic("malloc - bogus type"); #endif |