[ovs-dev] [PATCH v2] Fix a memory allocation bug in CFM

gyang at nicira.com gyang at nicira.com
Wed Sep 4 16:00:12 UTC 2013


From: Guolin Yang <gyang at nicira.com>

In cfm, when allocating the rmp array, the size is not calculated correctly
which cause the remote MPID not correctly updated in ovsdb.

Signed-off-by: Guolin Yang <gyang at nicira.com>
---
v1->v2
    Change description of the fix based on Ben's comments
---
 lib/cfm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cfm.c b/lib/cfm.c
index 297894e..d5eca0f 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -862,7 +862,7 @@ cfm_get_remote_mpids(const struct cfm *cfm, uint64_t **rmps, size_t *n_rmps)
     OVS_EXCLUDED(mutex)
 {
     ovs_mutex_lock(&mutex);
-    *rmps = xmemdup(cfm->rmps_array, cfm->rmps_array_len);
+    *rmps = xmemdup(cfm->rmps_array, cfm->rmps_array_len * sizeof (uint64_t));
     *n_rmps = cfm->rmps_array_len;
     ovs_mutex_unlock(&mutex);
 }
-- 
1.7.9.5




More information about the dev mailing list