Use m_get2() to get mbuf of appropriate size.

Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2013-03-12 12:19:23 +00:00
parent bd54830bcb
commit 3e45ef4059
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248196

View File

@ -459,9 +459,7 @@ xdr_string_encode(char *str, int len)
if (mlen > MCLBYTES) /* If too big, we just can't do it. */
return (NULL);
m = m_get(M_WAITOK, MT_DATA);
if (mlen > MLEN)
MCLGET(m, M_WAITOK);
m = m_get2(M_WAITOK, MT_DATA, 0, mlen);
xs = mtod(m, struct xdr_string *);
m->m_len = mlen;
xs->len = txdr_unsigned(len);