eliminate extraneous null ptr checks

Noticed by:	Coverity Prevent analysis tool
This commit is contained in:
Sam Leffler 2005-03-29 01:10:46 +00:00
parent 9f54ed72d5
commit 812d865346
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144260
3 changed files with 5 additions and 5 deletions

View File

@ -580,11 +580,11 @@ rip_attach(struct socket *so, int proto, struct thread *td)
INP_INFO_WUNLOCK(&ripcbinfo);
return EINVAL;
}
if (td && jailed(td->td_ucred) && !jail_allow_raw_sockets) {
if (jailed(td->td_ucred) && !jail_allow_raw_sockets) {
INP_INFO_WUNLOCK(&ripcbinfo);
return (EPERM);
}
if (td && (error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL)) != 0) {
if ((error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL)) != 0) {
INP_INFO_WUNLOCK(&ripcbinfo);
return error;
}

View File

@ -366,7 +366,7 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
if (sinp->sin_family == AF_INET
&& IN_MULTICAST(ntohl(sinp->sin_addr.s_addr)))
return (EAFNOSUPPORT);
if (td && jailed(td->td_ucred))
if (jailed(td->td_ucred))
prison_remote_ip(td->td_ucred, 0, &sinp->sin_addr.s_addr);
COMMON_START();

View File

@ -790,7 +790,7 @@ udp_output(inp, m, addr, control, td)
if (addr) {
sin = (struct sockaddr_in *)addr;
if (td && jailed(td->td_ucred))
if (jailed(td->td_ucred))
prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr);
if (inp->inp_faddr.s_addr != INADDR_ANY) {
error = EISCONN;
@ -1006,7 +1006,7 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
}
s = splnet();
sin = (struct sockaddr_in *)nam;
if (td && jailed(td->td_ucred))
if (jailed(td->td_ucred))
prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr);
error = in_pcbconnect(inp, nam, td->td_ucred);
splx(s);