diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2012-02-26 13:51:05 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2012-02-26 13:51:05 +0000 |
commit | 9493639e358f3e191dca3c831d22c65b2001ccee (patch) | |
tree | 27c94ce08e4d0a58c917156a679321016dc58637 /sys/kern/uipc_socket.c | |
parent | 3cc28bd9bf399d6f1329796afa8a846ac23bcdf3 (diff) | |
download | src-9493639e358f3e191dca3c831d22c65b2001ccee.tar.gz src-9493639e358f3e191dca3c831d22c65b2001ccee.zip |
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
Notes
Notes:
svn path=/head/; revision=232178
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index d11e87067900..4cd6a93e5581 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; |