[ovs-dev] [PATCH] vconn: Initialize 'recv_any_version' member of struct vconn in vconn_init().

Ben Pfaff blp at nicira.com
Fri Jan 25 23:21:16 UTC 2013


This uninitialized data caused failures in the test "ofproto -
eviction upon table overflow (OpenFlow 1.2)" for some developers and in
some circumstances.

Found by valgrind.

Reported-by: Justin Pettit <jpettit at nicira.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/vconn.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/lib/vconn.c b/lib/vconn.c
index ea1e130..bf40b1b 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -1112,17 +1112,13 @@ void
 vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status,
            const char *name, uint32_t allowed_versions)
 {
+    memset(vconn, 0, sizeof *vconn);
     vconn->class = class;
     vconn->state = (connect_status == EAGAIN ? VCS_CONNECTING
                     : !connect_status ? VCS_SEND_HELLO
                     : VCS_DISCONNECTED);
     vconn->error = connect_status;
-    vconn->version = 0;
     vconn->allowed_versions = allowed_versions;
-    vconn->remote_ip = 0;
-    vconn->remote_port = 0;
-    vconn->local_ip = 0;
-    vconn->local_port = 0;
     vconn->name = xstrdup(name);
     ovs_assert(vconn->state != VCS_CONNECTING || class->connect);
 }
-- 
1.7.2.5




More information about the dev mailing list