[ovs-discuss] [PATCH 2/4] Cleanup incorrect unitialized variable warnings.

Justin Pettit jpettit at nicira.com
Wed Aug 26 00:08:13 UTC 2009


The NetBSD compiler warns that these variables may be used unitialized.
They are not, but this commit gets rid of the warnings.
---
 lib/dpif.c        |    2 +-
 ofproto/ofproto.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index e823fa3..649c246 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -397,7 +397,7 @@ dpif_port_list(const struct dpif *dpif,
                struct odp_port **portsp, size_t *n_portsp)
 {
     struct odp_port *ports;
-    size_t n_ports;
+    size_t n_ports = 0;
     int error;
 
     for (;;) {
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index c26cdc2..dbaa75b 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3131,7 +3131,7 @@ send_flow_exp(struct ofproto *p, struct rule *rule,
 {
     struct ofconn *ofconn;
     struct ofconn *prev;
-    struct ofpbuf *buf;
+    struct ofpbuf *buf = NULL;
 
     /* We limit the maximum number of queued flow expirations it by accounting
      * them under the counter for replies.  That works because preventing
-- 
1.6.0.6





More information about the discuss mailing list