diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 22 | ||||
-rw-r--r-- | sys/opencrypto/cryptosoft.c | 2 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 2 |
3 files changed, 10 insertions, 16 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 52b6bb1..aa6e532 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -761,14 +761,13 @@ out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) */ int m_apply(struct mbuf *m, int off, int len, - int (*f)(void *, caddr_t, unsigned int), void *arg) + int (*f)(void *, void *, u_int), void *arg) { - unsigned int count; + u_int count; int rval; KASSERT(off >= 0, ("m_apply, negative off %d", off)); KASSERT(len >= 0, ("m_apply, negative len %d", len)); - while (off > 0) { KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain")); if (off < m->m_len) @@ -779,16 +778,13 @@ m_apply(struct mbuf *m, int off, int len, while (len > 0) { KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain")); count = min(m->m_len - off, len); - rval = (*f)(arg, mtod(m, caddr_t) + off, count); if (rval) return (rval); - len -= count; off = 0; m = m->m_next; } - return (0); } @@ -800,25 +796,23 @@ m_getptr(struct mbuf *m, int loc, int *off) { while (loc >= 0) { - /* Normal end of search */ + /* Normal end of search. */ if (m->m_len > loc) { *off = loc; return (m); } else { loc -= m->m_len; - if (m->m_next == NULL) { if (loc == 0) { - /* Point at the end of valid data */ + /* Point at the end of valid data. */ *off = m->m_len; return (m); - } else - return (NULL); - } else - m = m->m_next; + } + return (NULL); + } + m = m->m_next; } } - return (NULL); } diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 3225620..051edbd 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -453,7 +453,7 @@ swcr_authcompute(struct cryptop *crp, struct cryptodesc *crd, break; case CRYPTO_BUF_MBUF: err = m_apply((struct mbuf *) buf, crd->crd_skip, crd->crd_len, - (int (*)(void *, caddr_t, unsigned int)) axf->Update, + (int (*)(void *, void *, unsigned int)) axf->Update, (caddr_t) &ctx); if (err) return err; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 18422f1..1c2cb3e 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -436,7 +436,7 @@ extern int nsfbufs; /* Number of sendfile(2) bufs */ void _mext_free(struct mbuf *); void m_adj(struct mbuf *, int); int m_apply(struct mbuf *, int, int, - int (*)(void *, caddr_t, unsigned int), void *); + int (*)(void *, void *, unsigned int), void *); void m_cat(struct mbuf *, struct mbuf *); void m_chtype(struct mbuf *, short); void m_clget(struct mbuf *, int); |