diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-03-17 04:21:58 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-03-17 04:21:58 +0000 |
commit | 45ae4194cfa278c1ec75c7bf097027ff73912310 (patch) | |
tree | c59a7de53cb85641c2e5c608839486bf01250b37 /sys | |
parent | d766c542969ad80916e41a5110f08ba122d811c0 (diff) |
rev 1.77
m_cat() - if it is safe, copy data portion into 1st mbuf even if 1st mbuf
is M_EXT mbuf.
rev 1.72
clarify comment on m_cat().
From itojun NetBSD
ok claudio@ mcbride@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index de19ca5cf4a..35a1f693213 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.73 2006/03/05 00:44:25 brad Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.74 2006/03/17 04:21:57 brad Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -433,7 +433,9 @@ out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) /* * Concatenate mbuf chain n to m. - * Both chains must be of the same type (e.g. MT_DATA). + * n might be copied into m (when n->m_len is small), therefore data portion of + * n could be copied into an mbuf of different mbuf type. + * Therefore both chains should be of the same type (e.g. MT_DATA). * Any m_pkthdr is not updated. */ void @@ -442,8 +444,7 @@ m_cat(struct mbuf *m, struct mbuf *n) while (m->m_next) m = m->m_next; while (n) { - if (m->m_flags & M_EXT || - m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) { + if (M_READONLY(m) || n->m_len > M_TRAILINGSPACE(m)) { /* just join the two chains */ m->m_next = n; return; |