[ovs-dev] [PATCH 02/15] vswitch: Fix uninitialized variable.

Ben Pfaff blp at nicira.com
Wed Feb 10 11:30:25 PST 2010


The 'ip' variable in this inner "if" statement shadows a variable with
the same name in the enclosing block.  The variable in the inner block
is never initialized.

Found by Clang (http://clang-analyzer.llvm.org).
---
 vswitchd/bridge.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 05ace79..53b20e3 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1472,7 +1472,7 @@ bridge_reconfigure_controller(const struct ovsrec_open_vswitch *ovs_cfg,
             local_iface = bridge_get_local_iface(br);
             if (local_iface && c->local_ip && inet_aton(c->local_ip, &ip)) {
                 struct netdev *netdev = local_iface->netdev;
-                struct in_addr ip, mask, gateway;
+                struct in_addr mask, gateway;
 
                 if (!c->local_netmask || !inet_aton(c->local_netmask, &mask)) {
                     mask.s_addr = 0;
-- 
1.6.6.1





More information about the dev mailing list