Use m_get2() to get mbuf of appropriate size.
Sponsored by: Nginx, Inc.
This commit is contained in:
parent
bd54830bcb
commit
3e45ef4059
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248196
@ -459,9 +459,7 @@ xdr_string_encode(char *str, int len)
|
|||||||
if (mlen > MCLBYTES) /* If too big, we just can't do it. */
|
if (mlen > MCLBYTES) /* If too big, we just can't do it. */
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
m = m_get(M_WAITOK, MT_DATA);
|
m = m_get2(M_WAITOK, MT_DATA, 0, mlen);
|
||||||
if (mlen > MLEN)
|
|
||||||
MCLGET(m, M_WAITOK);
|
|
||||||
xs = mtod(m, struct xdr_string *);
|
xs = mtod(m, struct xdr_string *);
|
||||||
m->m_len = mlen;
|
m->m_len = mlen;
|
||||||
xs->len = txdr_unsigned(len);
|
xs->len = txdr_unsigned(len);
|
||||||
|
Loading…
Reference in New Issue
Block a user