summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-02-26 13:51:05 +0000
committerkib <kib@FreeBSD.org>2012-02-26 13:51:05 +0000
commit18b7fd6ba380a5cd9998a1717bae17f595440bd4 (patch)
tree27c94ce08e4d0a58c917156a679321016dc58637 /sys/kern/uipc_socket.c
parent76b96a73a21dcf5aeee696374140cc282c98ff0f (diff)
downloadFreeBSD-src-18b7fd6ba380a5cd9998a1717bae17f595440bd4.zip
FreeBSD-src-18b7fd6ba380a5cd9998a1717bae17f595440bd4.tar.gz
Remove apparently redundand checks for socket so_proto being non-NULL
from sosetopt() and sogetopt(). No exposed sockets may have so_proto invalid. Discussed with: bz, rwatson Reviewed by: glebius MFC after: 2 weeks
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index d11e870..4cd6a93 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -2447,7 +2447,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
CURVNET_SET(so->so_vnet);
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
- if (so->so_proto && so->so_proto->pr_ctloutput) {
+ if (so->so_proto->pr_ctloutput != NULL) {
error = (*so->so_proto->pr_ctloutput)(so, sopt);
CURVNET_RESTORE();
return (error);
@@ -2508,8 +2508,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
error = EINVAL;
goto bad;
}
- if (so->so_proto != NULL &&
- ((so->so_proto->pr_domain->dom_family == PF_INET) ||
+ if (((so->so_proto->pr_domain->dom_family == PF_INET) ||
(so->so_proto->pr_domain->dom_family == PF_INET6) ||
(so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
so->so_fibnum = optval;
@@ -2641,11 +2640,8 @@ sosetopt(struct socket *so, struct sockopt *sopt)
error = ENOPROTOOPT;
break;
}
- if (error == 0 && so->so_proto != NULL &&
- so->so_proto->pr_ctloutput != NULL) {
- (void) ((*so->so_proto->pr_ctloutput)
- (so, sopt));
- }
+ if (error == 0 && so->so_proto->pr_ctloutput != NULL)
+ (void)(*so->so_proto->pr_ctloutput)(so, sopt);
}
bad:
CURVNET_RESTORE();
@@ -2695,7 +2691,7 @@ sogetopt(struct socket *so, struct sockopt *sopt)
CURVNET_SET(so->so_vnet);
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
- if (so->so_proto && so->so_proto->pr_ctloutput)
+ if (so->so_proto->pr_ctloutput != NULL)
error = (*so->so_proto->pr_ctloutput)(so, sopt);
else
error = ENOPROTOOPT;
OpenPOWER on IntegriCloud