mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-26 11:47:31 +00:00
In m_align() add assertions that mbuf is virgin, similar to assertions
in M_ALIGN(), MH_ALIGN, MEXT_ALIGN() macros.
This commit is contained in:
parent
23909ac90d
commit
4f67e14304
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248418
@ -395,7 +395,7 @@ m_demote(struct mbuf *m0, int all)
|
||||
m_freem(m->m_nextpkt);
|
||||
m->m_nextpkt = NULL;
|
||||
}
|
||||
m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_FREELIST|M_NOFREE);
|
||||
m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1877,14 +1877,22 @@ m_mbuftouio(struct uio *uio, struct mbuf *m, int len)
|
||||
void
|
||||
m_align(struct mbuf *m, int len)
|
||||
{
|
||||
#ifdef INVARIANTS
|
||||
const char *msg = "%s: not a virgin mbuf";
|
||||
#endif
|
||||
int adjust;
|
||||
|
||||
if (m->m_flags & M_EXT)
|
||||
if (m->m_flags & M_EXT) {
|
||||
KASSERT(m->m_data == m->m_ext.ext_buf, (msg, __func__));
|
||||
adjust = m->m_ext.ext_size - len;
|
||||
else if (m->m_flags & M_PKTHDR)
|
||||
} else if (m->m_flags & M_PKTHDR) {
|
||||
KASSERT(m->m_data == m->m_pktdat, (msg, __func__));
|
||||
adjust = MHLEN - len;
|
||||
else
|
||||
} else {
|
||||
KASSERT(m->m_data == m->m_dat, (msg, __func__));
|
||||
adjust = MLEN - len;
|
||||
}
|
||||
|
||||
m->m_data += adjust &~ (sizeof(long)-1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user