summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-01-11 01:29:18 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-01-11 01:29:18 +0000
commit7e827095f2295647e9fcdb77554d7d79c7170ea4 (patch)
tree62911f1cf754e3ad9c13f2ed3309e97ac4cdb3b6 /sys/kern
parent260254feed869435f896d15074e7607bb723e848 (diff)
Sanity panics into DIAGNOSTIC
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_rmap.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/kern/subr_rmap.c b/sys/kern/subr_rmap.c
index 0e7662246ed..c15f13c24c1 100644
--- a/sys/kern/subr_rmap.c
+++ b/sys/kern/subr_rmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_rmap.c,v 1.3 1996/04/21 22:27:23 deraadt Exp $ */
+/* $OpenBSD: subr_rmap.c,v 1.4 1999/01/11 01:29:17 niklas Exp $ */
/* $NetBSD: subr_rmap.c,v 1.11 1996/03/16 23:17:11 christos Exp $ */
/*
@@ -61,9 +61,12 @@ rminit(mp, size, addr, name, nelem)
{
struct mapent *ep;
+#ifdef DIAGNOSTIC
/* mapsize had better be at least 2 */
if (nelem < 2 || addr <= 0 || size < 0)
panic("rminit %s",name);
+#endif
+
mp->m_name = name;
mp->m_limit = (struct mapent *)mp + nelem;
@@ -90,9 +93,11 @@ rmalloc(mp, size)
long addr;
/* first check arguments */
+#ifdef DIAGNOSTIC
if (size < 0)
panic("rmalloc %s", mp->m_name);
- if (!size)
+#endif
+ if (size <= 0)
return 0;
fp = 0;
@@ -140,9 +145,11 @@ rmfree(mp, size, addr)
{
struct mapent *ep, *fp;
+#ifdef DIAGNOSTIC
/* first check arguments */
if (size <= 0 || addr <= 0)
panic("rmfree %s", mp->m_name);
+#endif
while (1) {
fp = 0;
@@ -158,8 +165,11 @@ rmfree(mp, size, addr)
if (ep < mp->m_limit
&& ep[1].m_addr
&& (addr += size) >= ep[1].m_addr) {
- if (addr > ep[1].m_addr) /* overlapping frees? */
+#ifdef DIAGNOSTIC
+ /* overlapping frees? */
+ if (addr > ep[1].m_addr)
panic("rmfree %s", mp->m_name);
+#endif
/* the next slot is now contiguous, so join ... */
ep->m_size += ep[1].m_size;
ovbcopy(ep + 2, ep + 1,