[patch] remove negative socklen_t checks
Sergey Kandaurov
pluknet at gmail.com
Wed Feb 20 17:19:24 UTC 2013
Hi.
These checks are useless after the address length argument is converted
to socklen_t (up to SUSv2). Any objections?
Index: lib/libc/sys/accept.2
===================================================================
--- lib/libc/sys/accept.2 (revision 245745)
+++ lib/libc/sys/accept.2 (working copy)
@@ -28,7 +28,7 @@
.\" @(#)accept.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd December 11, 1993
+.Dd February 20, 2013
.Dt ACCEPT 2
.Os
.Sh NAME
@@ -154,10 +154,6 @@ The descriptor references a file, not a socket.
.It Bq Er EINVAL
.Xr listen 2
has not been called on the socket descriptor.
-.It Bq Er EINVAL
-The
-.Fa addrlen
-argument is negative.
.It Bq Er EFAULT
The
.Fa addr
Index: sys/kern/uipc_syscalls.c
===================================================================
--- sys/kern/uipc_syscalls.c (revision 246354)
+++ sys/kern/uipc_syscalls.c (working copy)
@@ -353,8 +353,6 @@ kern_accept(struct thread *td, int s, struct socka
if (name) {
*name = NULL;
- if (*namelen < 0)
- return (EINVAL);
}
AUDIT_ARG_FD(s);
@@ -1327,8 +1325,6 @@ kern_setsockopt(td, s, level, name, val, valseg, v
if (val == NULL && valsize != 0)
return (EFAULT);
- if ((int)valsize < 0)
- return (EINVAL);
sopt.sopt_dir = SOPT_SET;
sopt.sopt_level = level;
@@ -1406,8 +1402,6 @@ kern_getsockopt(td, s, level, name, val, valseg, v
if (val == NULL)
*valsize = 0;
- if ((int)*valsize < 0)
- return (EINVAL);
sopt.sopt_dir = SOPT_GET;
sopt.sopt_level = level;
@@ -1484,9 +1478,6 @@ kern_getsockname(struct thread *td, int fd, struct
socklen_t len;
int error;
- if (*alen < 0)
- return (EINVAL);
-
AUDIT_ARG_FD(fd);
error = getsock_cap(td->td_proc->p_fd, fd, CAP_GETSOCKNAME, &fp, NULL);
if (error)
@@ -1584,9 +1575,6 @@ kern_getpeername(struct thread *td, int fd, struct
socklen_t len;
int error;
- if (*alen < 0)
- return (EINVAL);
-
AUDIT_ARG_FD(fd);
error = getsock_cap(td->td_proc->p_fd, fd, CAP_GETPEERNAME, &fp, NULL);
if (error)
--
wbr,
pluknet
More information about the freebsd-current
mailing list