Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jan 2015 11:52:09 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277380 - head/sys/netinet
Message-ID:  <201501191152.t0JBq9rt076611@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Mon Jan 19 11:52:08 2015
New Revision: 277380
URL: https://svnweb.freebsd.org/changeset/base/277380

Log:
  Code cleanup.
  
  Reported by:	Coverity
  CID:		749578
  MFC after:	1 week

Modified:
  head/sys/netinet/sctp_timer.c

Modified: head/sys/netinet/sctp_timer.c
==============================================================================
--- head/sys/netinet/sctp_timer.c	Mon Jan 19 11:07:29 2015	(r277379)
+++ head/sys/netinet/sctp_timer.c	Mon Jan 19 11:52:08 2015	(r277380)
@@ -337,7 +337,7 @@ sctp_find_alternate_net(struct sctp_tcb 
 			return (NULL);
 		}
 	}
-	do {
+	for (;;) {
 		alt = TAILQ_NEXT(mnet, sctp_next);
 		if (alt == NULL) {
 			once++;
@@ -356,7 +356,6 @@ sctp_find_alternate_net(struct sctp_tcb 
 			}
 			alt->src_addr_selected = 0;
 		}
-		/* sa_ignore NO_NULL_CHK */
 		if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) &&
 		    (alt->ro.ro_rt != NULL) &&
 		    (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) {
@@ -364,14 +363,14 @@ sctp_find_alternate_net(struct sctp_tcb 
 			break;
 		}
 		mnet = alt;
-	} while (alt != NULL);
+	}
 
 	if (alt == NULL) {
 		/* Case where NO insv network exists (dormant state) */
 		/* we rotate destinations */
 		once = 0;
 		mnet = net;
-		do {
+		for (;;) {
 			if (mnet == NULL) {
 				return (TAILQ_FIRST(&stcb->asoc.nets));
 			}
@@ -382,15 +381,17 @@ sctp_find_alternate_net(struct sctp_tcb 
 					break;
 				}
 				alt = TAILQ_FIRST(&stcb->asoc.nets);
+				if (alt == NULL) {
+					break;
+				}
 			}
-			/* sa_ignore NO_NULL_CHK */
 			if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) &&
 			    (alt != net)) {
 				/* Found an alternate address */
 				break;
 			}
 			mnet = alt;
-		} while (alt != NULL);
+		}
 	}
 	if (alt == NULL) {
 		return (net);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501191152.t0JBq9rt076611>