diff options
author | alfred <alfred@FreeBSD.org> | 1999-10-13 09:55:42 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 1999-10-13 09:55:42 +0000 |
commit | c92072a8edfc37038ce0105001977bc45727865b (patch) | |
tree | 71bc99790e3c6c80fa6c1dbe593c0065f242a211 /sys/kern/uipc_mbuf.c | |
parent | 173a5920a154fa22367a339239da421cc60c406d (diff) | |
download | FreeBSD-src-c92072a8edfc37038ce0105001977bc45727865b.zip FreeBSD-src-c92072a8edfc37038ce0105001977bc45727865b.tar.gz |
change identical and "programming error" panic("mcopy*")'s into
more verbose messages using KASSERT.
Reviewed by: eivind, des
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index fdf341d..d84cf0b 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -437,13 +437,12 @@ m_copym(m, off0, len, wait) struct mbuf *top; int copyhdr = 0; - if (off < 0 || len < 0) - panic("m_copym"); + KASSERT(off >= 0, ("m_copym, negative off %d", off)); + KASSERT(len >= 0, ("m_copym, negative len %d", len)); if (off == 0 && m->m_flags & M_PKTHDR) copyhdr = 1; while (off > 0) { - if (m == 0) - panic("m_copym"); + KASSERT(m != NULL, ("m_copym, offset > size of mbuf chain")); if (off < m->m_len) break; off -= m->m_len; @@ -453,8 +452,8 @@ m_copym(m, off0, len, wait) top = 0; while (len > 0) { if (m == 0) { - if (len != M_COPYALL) - panic("m_copym"); + KASSERT(len == M_COPYALL, + ("m_copym, length > size of mbuf chain")); break; } MGET(n, wait, m->m_type); @@ -573,19 +572,17 @@ m_copydata(m, off, len, cp) { register unsigned count; - if (off < 0 || len < 0) - panic("m_copydata"); + KASSERT(off >= 0, ("m_copydata, negative off %d", off)); + KASSERT(len >= 0, ("m_copydata, negative len %d", len)); while (off > 0) { - if (m == 0) - panic("m_copydata"); + KASSERT(m != NULL, ("m_copydata, offset > size of mbuf chain")); if (off < m->m_len) break; off -= m->m_len; m = m->m_next; } while (len > 0) { - if (m == 0) - panic("m_copydata"); + KASSERT(m != NULL, ("m_copydata, length > size of mbuf chain")); count = min(m->m_len - off, len); bcopy(mtod(m, caddr_t) + off, cp, count); len -= count; |