mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-11 04:42:16 +01:00
net80211: replace m_getcl/m_gethdr pair with m_get2 in ieee80211_fragment()
- Switch to m_get2() for mbuf allocation instead of manual mbuf size determination. - Reuse MIN() macro for mbuf size selection.
This commit is contained in:
parent
8722deef15
commit
18d20be00f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300911
@ -1679,16 +1679,8 @@ ieee80211_fragment(struct ieee80211vap *vap, struct mbuf *m0,
|
|||||||
remainder = m0->m_pkthdr.len - off;
|
remainder = m0->m_pkthdr.len - off;
|
||||||
prev = m0;
|
prev = m0;
|
||||||
do {
|
do {
|
||||||
fragsize = totalhdrsize + remainder;
|
fragsize = MIN(totalhdrsize + remainder, mtu);
|
||||||
if (fragsize > mtu)
|
m = m_get2(fragsize, M_NOWAIT, MT_DATA, M_PKTHDR);
|
||||||
fragsize = mtu;
|
|
||||||
/* XXX fragsize can be >2048! */
|
|
||||||
KASSERT(fragsize < MCLBYTES,
|
|
||||||
("fragment size %u too big!", fragsize));
|
|
||||||
if (fragsize > MHLEN)
|
|
||||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
|
|
||||||
else
|
|
||||||
m = m_gethdr(M_NOWAIT, MT_DATA);
|
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
goto bad;
|
goto bad;
|
||||||
/* leave room to prepend any cipher header */
|
/* leave room to prepend any cipher header */
|
||||||
|
Loading…
Reference in New Issue
Block a user