diff options
author | Christine Caulfield <ccaulfie@redhat.com> | 2008-04-01 15:01:30 +0000 |
---|---|---|
committer | Christine Caulfield <ccaulfie@redhat.com> | 2008-04-01 15:01:30 +0000 |
commit | 611c0689fccf0953d754098a63322e5b29cc4bf9 (patch) | |
tree | 6e5991222cd9b9de1e657d09f77cdc422517bc09 /daemons/clvmd/clvmd-cman.c | |
parent | 9332d2cb9d64a8a07f0d46988935902979c4e34f (diff) | |
download | lvm2-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.c | 12 |
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) |