diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2018-03-13 01:34:07 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2018-03-13 01:34:07 +0000 |
commit | aa6e0fdffa87fe91cde00764cf5a7adc919c10b8 (patch) | |
tree | 027a09a7c5815fe260be3291c7ae551dac063926 /sys | |
parent | 8642a84272f68002872f60e60dea1a2e9eff4047 (diff) |
make m_pullup skip over empty mbufs when finding the payload alignment.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 5535225f60f..82e9367fdb8 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.254 2018/03/12 23:38:42 dlg Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.255 2018/03/13 01:34:06 dlg Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -888,7 +888,11 @@ m_pullup(struct mbuf *n, int len) if (len <= n->m_len) return (n); - adj = (unsigned long)n->m_data & ALIGNBYTES; + m = n; + while (m->m_len == 0) + m = m->m_next; + adj = (unsigned long)m->m_data & ALIGNBYTES; + head = (caddr_t)ALIGN(mtod(n, caddr_t) - M_LEADINGSPACE(n)) + adj; tail = mtod(n, caddr_t) + n->m_len + M_TRAILINGSPACE(n); |