diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2013-03-15 10:17:24 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2013-03-15 10:17:24 +0000 |
commit | 93cfe76349470fe420eebc50004cb45ab16ae55a (patch) | |
tree | 451d77693bff31dd270272818347d930cf22000b /sys/kern/uipc_syscalls.c | |
parent | 3112ae76449ae0931d207603f14b083627bd731d (diff) | |
download | src-93cfe76349470fe420eebc50004cb45ab16ae55a.tar.gz src-93cfe76349470fe420eebc50004cb45ab16ae55a.zip |
- Use m_get2() instead of hand allocating.
- No need for u_int cast here.
Sponsored by: Nginx, Inc.
Notes
Notes:
svn path=/head/; revision=248316
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 4827cab53d6f..3a2f0329f537 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) |