diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2011-11-30 01:16:10 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2011-11-30 01:16:10 +0000 |
commit | 7e83769021b899a4b84eec7b26e4509d235f4cad (patch) | |
tree | 2b202dfc7ce93a32c46758a515e2713e61dbf44a | |
parent | 1cb31a2098e2bba592d73a2e88e04bdaab9646d9 (diff) |
correctly calculate the space available in external storage in m_pullup.
ok deraadt@ claudio@ blambert@ mikeb@
-rw-r--r-- | sys/kern/uipc_mbuf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index bb25cd65a4c..4bc76ed4a4f 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.162 2011/11/29 10:39:11 dlg Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.163 2011/11/30 01:16:09 dlg Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -934,15 +934,15 @@ m_pullup(struct mbuf *n, int len) * without shifting current data, pullup into it, * otherwise allocate a new mbuf to prepend to the chain. */ - if ((n->m_flags & M_EXT) == 0 && - n->m_data + len < &n->m_dat[MLEN] && n->m_next) { + if ((n->m_flags & M_EXT) == 0 && n->m_next && + n->m_data + len < &n->m_dat[MLEN]) { if (n->m_len >= len) return (n); m = n; n = n->m_next; len -= m->m_len; - } else if ((n->m_flags & M_EXT) != 0 && len > MHLEN && - n->m_data + len < &n->m_data[MCLBYTES] && n->m_next) { + } else if ((n->m_flags & M_EXT) != 0 && len > MHLEN && n->m_next && + n->m_data + len < &n->m_ext.ext_buf[n->m_ext.ext_size]) { if (n->m_len >= len) return (n); m = n; |