summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2013-03-15 10:17:24 +0000
committerglebius <glebius@FreeBSD.org>2013-03-15 10:17:24 +0000
commit4d24ab3136bd066fd4c31400aa74b0bbc7e5d664 (patch)
tree451d77693bff31dd270272818347d930cf22000b
parent4502cb662c82b7919c3dd6c0616a07f8bc59ca55 (diff)
downloadFreeBSD-src-4d24ab3136bd066fd4c31400aa74b0bbc7e5d664.zip
FreeBSD-src-4d24ab3136bd066fd4c31400aa74b0bbc7e5d664.tar.gz
- Use m_get2() instead of hand allocating.
- No need for u_int cast here. Sponsored by: Nginx, Inc.
-rw-r--r--sys/kern/uipc_syscalls.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 4827cab..3a2f032 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1701,18 +1701,16 @@ sockargs(mp, buf, buflen, type)
struct mbuf *m;
int error;
- if ((u_int)buflen > MLEN) {
+ if (buflen > MLEN) {
#ifdef COMPAT_OLDSOCK
- if (type == MT_SONAME && (u_int)buflen <= 112)
+ if (type == MT_SONAME && buflen <= 112)
buflen = MLEN; /* unix domain compat. hack */
else
#endif
- if ((u_int)buflen > MCLBYTES)
+ if (buflen > MCLBYTES)
return (EINVAL);
}
- m = m_get(M_WAITOK, type);
- if ((u_int)buflen > MLEN)
- MCLGET(m, M_WAITOK);
+ m = m_get2(buflen, M_WAITOK, type, 0);
m->m_len = buflen;
error = copyin(buf, mtod(m, caddr_t), (u_int)buflen);
if (error)
OpenPOWER on IntegriCloud