summaryrefslogtreecommitdiffstats
path: root/sys/sys/mbuf.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/sys/mbuf.h')
-rw-r--r--sys/sys/mbuf.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 4a28e02..08dfb60 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -455,6 +455,10 @@ m_chtype(struct mbuf *m, short new_type)
* an object of the specified size at the end of the mbuf, longword aligned.
*/
#define M_ALIGN(m, len) do { \
+ KASSERT(!((m)->m_flags & (M_PKTHDR|M_EXT)), \
+ ("%s: M_ALIGN not normal mbuf", __func__)); \
+ KASSERT((m)->m_data == (m)->m_dat, \
+ ("%s: M_ALIGN not a virgin mbuf", __func__)); \
(m)->m_data += (MLEN - (len)) & ~(sizeof(long) - 1); \
} while (0)
@@ -463,6 +467,10 @@ m_chtype(struct mbuf *m, short new_type)
* or initialized by M_COPY_PKTHDR.
*/
#define MH_ALIGN(m, len) do { \
+ KASSERT((m)->m_flags & M_PKTHDR && !((m)->m_flags & M_EXT), \
+ ("%s: MH_ALIGN not PKTHDR mbuf", __func__)); \
+ KASSERT((m)->m_data == (m)->m_pktdat, \
+ ("%s: MH_ALIGN not a virgin mbuf", __func__)); \
(m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1); \
} while (0)
OpenPOWER on IntegriCloud