svn commit: r283720 - stable/10/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Fri May 29 12:35:22 UTC 2015


Author: tuexen
Date: Fri May 29 12:35:21 2015
New Revision: 283720
URL: https://svnweb.freebsd.org/changeset/base/283720

Log:
  MFC r277380:
  
  Code cleanup.
  
  Reported by:	Coverity
  CID:		749578

Modified:
  stable/10/sys/netinet/sctp_timer.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/sctp_timer.c
==============================================================================
--- stable/10/sys/netinet/sctp_timer.c	Fri May 29 12:33:02 2015	(r283719)
+++ stable/10/sys/netinet/sctp_timer.c	Fri May 29 12:35:21 2015	(r283720)
@@ -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);


More information about the svn-src-all mailing list