LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH net-next v4 2/3] ipvs: Don't check result < 0 after setting resul

To: Wensong Zhang <wensong@xxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Patrick McHardy <kaber@xxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH net-next v4 2/3] ipvs: Don't check result < 0 after setting result = 0
Cc: Quentin Armitage <quentin@xxxxxxxxxxxxxxx>
From: Quentin Armitage <quentin@xxxxxxxxxxxxxxx>
Date: Thu, 16 Jun 2016 08:00:26 +0100
Move the block testing result < 0 to avoid the test immediately
after setting result = 0

Signed-off-by: Quentin Armitage <quentin@xxxxxxxxxxxxxxx>
---
 net/netfilter/ipvs/ip_vs_sync.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index fbc5ba4..2be99b2 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1496,13 +1496,14 @@ static struct socket *make_send_sock(struct netns_ipvs 
*ipvs, int id,
        if (result > 0)
                set_sock_size(sock->sk, 1, result);
 
-       if (AF_INET == ipvs->mcfg.mcast_af)
+       if (ipvs->mcfg.mcast_af == AF_INET) {
                result = bind_mcastif_addr(sock, dev);
-       else
+               if (result < 0) {
+                       pr_err("Error binding address of mcast interface\n");
+                       goto error;
+               }
+       } else {
                result = 0;
-       if (result < 0) {
-               pr_err("Error binding address of the mcast interface\n");
-               goto error;
        }
 
        get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->mcfg, id);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>