[PATCH] Fix 2 Coverity findings
Volker Lendecke
Volker.Lendecke at SerNet.DE
Tue Feb 16 10:28:49 UTC 2016
Hi!
Review appreciated!
Thanks, Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 063f6e7de32d4d07b20bade967d6603c6b7f9768 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 16 Feb 2016 11:18:40 +0100
Subject: [PATCH 1/2] ctdb: Fix CID 1353176 Logically dead code
Signed-off-by: Volker Lendecke <vl at samba.org>
---
ctdb/server/ipalloc_common.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/ctdb/server/ipalloc_common.c b/ctdb/server/ipalloc_common.c
index c84359b..95d5ecf 100644
--- a/ctdb/server/ipalloc_common.c
+++ b/ctdb/server/ipalloc_common.c
@@ -65,13 +65,12 @@ static bool can_node_host_ip(struct ipalloc_state *ipalloc_state,
if (ipalloc_state->noiphost[pnn]) {
return false;
}
-
- public_ips = &ipalloc_state->available_public_ips[pnn];
-
- if (public_ips == NULL) {
+ if (ipalloc_state->available_public_ips == NULL) {
return false;
}
+ public_ips = &ipalloc_state->available_public_ips[pnn];
+
for (i=0; i<public_ips->num; i++) {
if (ctdb_same_ip(&ip->addr, &public_ips->ip[i].addr)) {
/* yes, this node can serve this public ip */
--
1.7.9.5
From e65cb7212505b61dbe8007ee0e778e6435233f1c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 16 Feb 2016 11:20:56 +0100
Subject: [PATCH 2/2] ctdb: Fix CID 1353175 Logically dead code
Signed-off-by: Volker Lendecke <vl at samba.org>
---
ctdb/server/ctdb_takeover.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index cdb4601..62af1e6 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -1340,17 +1340,18 @@ create_merged_ip_list(struct ctdb_context *ctdb, struct ipalloc_state *ipalloc_s
ctdb->ip_tree = trbt_create(ctdb, 0);
for (i=0; i < ctdb->num_nodes; i++) {
- public_ips = &ipalloc_state->known_public_ips[i];
if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
continue;
}
/* there were no public ips for this node */
- if (public_ips == NULL) {
+ if (ipalloc_state->known_public_ips == NULL) {
continue;
}
+ public_ips = &ipalloc_state->known_public_ips[i];
+
for (j=0; j < public_ips->num; j++) {
struct public_ip_list *tmp_ip;
--
1.7.9.5
More information about the samba-technical
mailing list