summaryrefslogtreecommitdiff
path: root/sys/kern/subr_mchain.c
diff options
context:
space:
mode:
authorR. Imura <imura@FreeBSD.org>2005-07-29 13:22:37 +0000
committerR. Imura <imura@FreeBSD.org>2005-07-29 13:22:37 +0000
commit080e3a63b30ae73f6264a89d5ffa8d6990cd9d96 (patch)
tree549cc36b1d29a5047dca121ca0e375b41b375c0c /sys/kern/subr_mchain.c
parent1b3b403e9bbbb3bcb0acff2d4a30ef3eca19dfeb (diff)
downloadsrc-test2-080e3a63b30ae73f6264a89d5ffa8d6990cd9d96.tar.gz
src-test2-080e3a63b30ae73f6264a89d5ffa8d6990cd9d96.zip
Notes
Diffstat (limited to 'sys/kern/subr_mchain.c')
-rw-r--r--sys/kern/subr_mchain.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c
index 4f0dab1bb6f2..dc70af2928c1 100644
--- a/sys/kern/subr_mchain.c
+++ b/sys/kern/subr_mchain.c
@@ -183,6 +183,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type)
caddr_t dst;
c_caddr_t src;
int cplen, error, mleft, count;
+ size_t srclen, dstlen;
m = mbp->mb_cur;
mleft = mbp->mb_mleft;
@@ -199,10 +200,13 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type)
continue;
}
cplen = mleft > size ? size : mleft;
+ srclen = dstlen = cplen;
dst = mtod(m, caddr_t) + m->m_len;
switch (type) {
case MB_MCUSTOM:
- error = mbp->mb_copy(mbp, source, dst, cplen);
+ srclen = size;
+ dstlen = mleft;
+ error = mbp->mb_copy(mbp, source, dst, &srclen, &dstlen);
if (error)
return error;
break;
@@ -222,11 +226,11 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type)
bzero(dst, cplen);
break;
}
- size -= cplen;
- source += cplen;
- m->m_len += cplen;
- mleft -= cplen;
- mbp->mb_count += cplen;
+ size -= srclen;
+ source += srclen;
+ m->m_len += dstlen;
+ mleft -= dstlen;
+ mbp->mb_count += dstlen;
}
mbp->mb_cur = m;
mbp->mb_mleft = mleft;