diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-03-26 01:33:41 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-03-26 01:33:41 +0000 |
commit | 46492ab6604a4e31629809cf807aab827d7be8e5 (patch) | |
tree | a4c7639265c289cb5190edeaa1dedbf4f837f5b9 /sys/netinet/tcp_input.c | |
parent | 2f146bc4fd3bffebc6a8e11d8b6705fbfb27e64f (diff) | |
download | FreeBSD-src-46492ab6604a4e31629809cf807aab827d7be8e5.zip FreeBSD-src-46492ab6604a4e31629809cf807aab827d7be8e5.tar.gz |
Explicitly assert socket pointer is non-NULL in tcp_input() so as to
provide better debugging information.
Prefer explicit comparison to NULL for tcpcb pointers rather than
treating them as booleans.
MFC after: 1 month
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 836181d..18ccc34 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -784,6 +784,7 @@ findpcb: goto drop; #endif so = inp->inp_socket; + KASSERT(so != NULL, ("tcp_input: so == NULL")); #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) { ostate = tp->t_state; @@ -2552,7 +2553,7 @@ dropwithreset: (tcp_seq)0, TH_RST|TH_ACK); } - if (tp) + if (tp != NULL) INP_UNLOCK(inp); if (headlocked) INP_INFO_WUNLOCK(&tcbinfo); @@ -2563,11 +2564,11 @@ drop: * Drop space held by incoming segment and return. */ #ifdef TCPDEBUG - if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) + if (tp == NULL || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - if (tp) + if (tp != NULL) INP_UNLOCK(inp); if (headlocked) INP_INFO_WUNLOCK(&tcbinfo); |