Index: kern/uipc_mbuf.c =================================================================== RCS file: /cvsroot/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.153 diff -u -p -u -r1.153 uipc_mbuf.c --- kern/uipc_mbuf.c 9 Oct 2013 20:15:20 -0000 1.153 +++ kern/uipc_mbuf.c 14 Nov 2013 00:34:53 -0000 @@ -722,6 +722,11 @@ m_dup(struct mbuf *m, int off0, int len, return m_copym0(m, off0, len, wait, 1); /* deep copy */ } +static inline int +m_mbuflen(int len, int clen) { + return len == M_COPYALL ? clen : min(len, clen); +} + static struct mbuf * m_copym0(struct mbuf *m, int off0, int len, int wait, int deep) { @@ -764,7 +769,7 @@ m_copym0(struct mbuf *m, int off0, int l n->m_pkthdr.len = len; copyhdr = 0; } - n->m_len = min(len, m->m_len - off); + n->m_len = m_mbuflen(len, m->m_len - off); if (m->m_flags & M_EXT) { if (!deep) { n->m_data = m->m_data + off; @@ -776,7 +781,7 @@ m_copym0(struct mbuf *m, int off0, int l */ MCLGET(n, wait); n->m_len = M_TRAILINGSPACE(n); - n->m_len = min(n->m_len, len); + n->m_len = m_mbuflen(len, n->m_len); n->m_len = min(n->m_len, m->m_len - off); memcpy(mtod(n, void *), mtod(m, char *) + off, (unsigned)n->m_len); Index: sys/mbuf.h =================================================================== RCS file: /cvsroot/src/sys/sys/mbuf.h,v retrieving revision 1.152 diff -u -p -u -r1.152 mbuf.h --- sys/mbuf.h 27 Jun 2013 17:47:18 -0000 1.152 +++ sys/mbuf.h 14 Nov 2013 00:34:54 -0000 @@ -686,7 +686,7 @@ do { \ } while (/* CONSTCOND */ 0) /* length to m_copy to copy all */ -#define M_COPYALL 1000000000 +#define M_COPYALL -1 /* compatibility with 4.3 */ #define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)