[Sheepdog] [PATCH] sheep: fix the memmove bug in del_cpg_node

yaohaiting.wujue at gmail.com yaohaiting.wujue at gmail.com
Thu Mar 1 06:41:44 CET 2012


From: HaiTing Yao <wujue.yht at taobao.com>

The size is not right, maybe lead to error

Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
---
 sheep/cluster/corosync.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sheep/cluster/corosync.c b/sheep/cluster/corosync.c
index fcf1880..f6eec1d 100644
--- a/sheep/cluster/corosync.c
+++ b/sheep/cluster/corosync.c
@@ -130,7 +130,7 @@ static inline void del_cpg_node(struct cpg_node *nodes, size_t nr_nodes,
 	}
 
 	nr_nodes--;
-	memmove(nodes + idx, nodes + idx + 1, sizeof(*nodes) * nr_nodes - idx);
+	memmove(nodes + idx, nodes + idx + 1, sizeof(*nodes) * (nr_nodes - idx));
 }
 
 static int nodeid_to_addr(uint32_t nodeid, uint8_t *addr)
-- 
1.7.1




More information about the sheepdog mailing list