All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] sctp: fix test for end of loop
@ 2010-09-06 12:26 ` Dan Carpenter
  0 siblings, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2010-09-06 12:26 UTC (permalink / raw)
  To: Vlad Yasevich
  Cc: Sridhar Samudrala, David S. Miller, Wei Yongjun,
	Thadeu Lima de Souza Cascardo, linux-sctp, netdev,
	kernel-janitors

"new_addr" is the list cursor here and it's always non-NULL.

We're trying to test if we exited because the loop ended or we hit the
break statement.  Really testing !found is enough so long as 
"new_asoc->peer.transport_addr_list" is not empty and I believe it never
is empty at this point.  So this is never really a bug with the current
code.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Compile tested only.

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 24b2cd5..cb76d2e 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1254,7 +1254,6 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc,
 	/* Search through all current addresses and make sure
 	 * we aren't adding any new ones.
 	 */
-	new_addr = NULL;
 	found = 0;
 
 	list_for_each_entry(new_addr, &new_asoc->peer.transport_addr_list,
@@ -1273,7 +1272,8 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc,
 	}
 
 	/* If a new address was added, ABORT the sender. */
-	if (!found && new_addr) {
+	if (!found &&
+	    &new_addr->transports != &new_asoc->peer.transport_addr_list) {
 		sctp_sf_send_restart_abort(&new_addr->ipaddr, init, commands);
 	}
 

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-09-09 22:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 12:26 [patch] sctp: fix test for end of loop Dan Carpenter
2010-09-06 12:26 ` Dan Carpenter
2010-09-07  8:46 ` Shan Wei
2010-09-07  8:46   ` Shan Wei
2010-09-07 11:31   ` Dan Carpenter
2010-09-07 11:31     ` Dan Carpenter
2010-09-08 20:24 ` David Miller
2010-09-08 20:24   ` David Miller
2010-09-08 20:34   ` Vlad Yasevich
2010-09-08 20:34     ` Vlad Yasevich
2010-09-08 20:37     ` David Miller
2010-09-08 20:37       ` David Miller
2010-09-08 21:04       ` [Alternative PATCH net-next] " Joe Perches
2010-09-08 21:04         ` Joe Perches
2010-09-09 13:57         ` Vlad Yasevich
2010-09-09 13:57           ` Vlad Yasevich
2010-09-09 22:00           ` David Miller
2010-09-09 22:00             ` David Miller
2010-09-08 20:26 ` [patch] " Vlad Yasevich
2010-09-08 20:26   ` Vlad Yasevich
2010-09-08 20:30   ` David Miller
2010-09-08 20:30     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.