diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2014-02-14 16:40:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-17 00:26:26 -0500 |
commit | 074bb43e9e594bec647ec45cc5bbc8c1ac2306aa (patch) | |
tree | ae83abaf50cca7cdf6f1f295e2b3821ad8ada4e1 /net/tipc | |
parent | 6dd3c9ec2387725a8e529fae64415cd538b955b7 (diff) |
tipc: fix a loop style problem
In commit 7d33939f475d403e79124e3143d7951dcfe8629f
("tipc: delay delete of link when failover is needed") we
introduced a loop for finding and removing a link pointer
in an array. The removal is done after we have left the loop,
giving the impression that one may remove the wrong pointer
if no matching element is found.
This is not really a bug, since we know that there will always
be a matching element, but it looks wrong, and causes a smatch
warning.
We fix this loop with this commit.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/node.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 833324b73fe1..8596880877c0 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -252,12 +252,12 @@ void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | |||
252 | int i; | 252 | int i; |
253 | 253 | ||
254 | for (i = 0; i < MAX_BEARERS; i++) { | 254 | for (i = 0; i < MAX_BEARERS; i++) { |
255 | if (l_ptr == n_ptr->links[i]) | 255 | if (l_ptr != n_ptr->links[i]) |
256 | break; | 256 | continue; |
257 | n_ptr->links[i] = NULL; | ||
258 | atomic_dec(&tipc_num_links); | ||
259 | n_ptr->link_cnt--; | ||
257 | } | 260 | } |
258 | n_ptr->links[i] = NULL; | ||
259 | atomic_dec(&tipc_num_links); | ||
260 | n_ptr->link_cnt--; | ||
261 | } | 261 | } |
262 | 262 | ||
263 | static void node_established_contact(struct tipc_node *n_ptr) | 263 | static void node_established_contact(struct tipc_node *n_ptr) |