summaryrefslogtreecommitdiffstats
path: root/daemons/clvmd/clvmd-cman.c
diff options
context:
space:
mode:
authorChristine Caulfield <ccaulfie@redhat.com>2008-04-01 15:01:30 +0000
committerChristine Caulfield <ccaulfie@redhat.com>2008-04-01 15:01:30 +0000
commit611c0689fccf0953d754098a63322e5b29cc4bf9 (patch)
tree6e5991222cd9b9de1e657d09f77cdc422517bc09 /daemons/clvmd/clvmd-cman.c
parent9332d2cb9d64a8a07f0d46988935902979c4e34f (diff)
downloadlvm2-611c0689fccf0953d754098a63322e5b29cc4bf9.tar.gz
lvm2-611c0689fccf0953d754098a63322e5b29cc4bf9.tar.xz
lvm2-611c0689fccf0953d754098a63322e5b29cc4bf9.zip
Fix another allocation bug with clvmd and large node IDs.`
Diffstat (limited to 'daemons/clvmd/clvmd-cman.c')
-rw-r--r--daemons/clvmd/clvmd-cman.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c
index 47cc4a9b..fc3f3c8a 100644
--- a/daemons/clvmd/clvmd-cman.c
+++ b/daemons/clvmd/clvmd-cman.c
@@ -297,6 +297,8 @@ static void get_members()
{
int retnodes;
int status;
+ int i;
+ int high_nodeid = 0;
num_nodes = cman_get_node_count(c_handle);
if (num_nodes == -1) {
@@ -325,10 +327,16 @@ static void get_members()
exit(6);
}
+ /* Get the highest nodeid */
+ for (i=0; i<retnodes; i++) {
+ if (nodes[i].cn_nodeid > high_nodeid)
+ high_nodeid = nodes[i].cn_nodeid;
+ }
+
if (node_updown == NULL) {
size_t buf_len;
- if (num_nodes > max_updown_nodes)
- max_updown_nodes = num_nodes;
+ if (high_nodeid >= max_updown_nodes)
+ max_updown_nodes = high_nodeid + 1;
buf_len = sizeof(int) * max_updown_nodes;
node_updown = malloc(buf_len);
if (node_updown)