aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>1999-10-13 09:55:42 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>1999-10-13 09:55:42 +0000
commite0a653ddba7b122f68e6aa3fd1d7a5620a227852 (patch)
tree71bc99790e3c6c80fa6c1dbe593c0065f242a211 /sys/kern
parent4c04fa4c1a9e16ff8f66b8aabfb7687de812bf35 (diff)
downloadsrc-e0a653ddba7b122f68e6aa3fd1d7a5620a227852.tar.gz
src-e0a653ddba7b122f68e6aa3fd1d7a5620a227852.zip
change identical and "programming error" panic("mcopy*")'s into
more verbose messages using KASSERT. Reviewed by: eivind, des
Notes
Notes: svn path=/head/; revision=52201
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_mbuf.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index fdf341dc6cc2..d84cf0becc37 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;