summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2015-01-08 11:16:21 +0000
committerrwatson <rwatson@FreeBSD.org>2015-01-08 11:16:21 +0000
commita546fbcd7c1bd8e234421e5dab204a568bdcf722 (patch)
tree091367ba6d90a39eb357207cc1fb7ac16fa6f447 /sys/kern/uipc_mbuf.c
parent301c350b1177144436cf682d880da72f519f57c1 (diff)
downloadFreeBSD-src-a546fbcd7c1bd8e234421e5dab204a568bdcf722.zip
FreeBSD-src-a546fbcd7c1bd8e234421e5dab204a568bdcf722.tar.gz
Replace hand-crafted versions of M_SIZE() and M_START() in uipc_mbuf.c
with calls to the centralised macros, reducing direct use of MLEN and MHLEN. Differential Revision: https://reviews.freebsd.org/D1444 Reviewed by: bz Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index abeef08..9022faa 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -196,8 +196,7 @@ m_getm2(struct mbuf *m, int len, int how, short type, int flags)
}
/* Book keeping. */
- len -= (mb->m_flags & M_EXT) ? mb->m_ext.ext_size :
- ((mb->m_flags & M_PKTHDR) ? MHLEN : MLEN);
+ len -= M_SIZE(mb);
if (mtail != NULL)
mtail->m_next = mb;
else
@@ -430,11 +429,8 @@ m_sanity(struct mbuf *m0, int sanitize)
* unrelated kernel memory before or after us is trashed.
* No way to recover from that.
*/
- a = ((m->m_flags & M_EXT) ? m->m_ext.ext_buf :
- ((m->m_flags & M_PKTHDR) ? (caddr_t)(&m->m_pktdat) :
- (caddr_t)(&m->m_dat)) );
- b = (caddr_t)(a + (m->m_flags & M_EXT ? m->m_ext.ext_size :
- ((m->m_flags & M_PKTHDR) ? MHLEN : MLEN)));
+ a = M_START(m);
+ b = a + M_SIZE(m);
if ((caddr_t)m->m_data < a)
M_SANITY_ACTION("m_data outside mbuf data range left");
if ((caddr_t)m->m_data > b)
OpenPOWER on IntegriCloud