From: Ben Pfaff Date: Fri, 9 Sep 2011 17:12:32 +0000 (-0700) Subject: bridge: Avoid reading uninitialized data in bridge_pick_local_hw_addr(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d1fe4a36287a2e107f96e50a6ab3556da3726a3;p=openvswitch bridge: Avoid reading uninitialized data in bridge_pick_local_hw_addr(). Commit 3a48ace3 "bridge: Make bridge_pick_local_hw_addr() easier to reason" didn't initialize 'ea' before trying to compare against it. We need to check that an address has been found. Found by valgrind. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index abea4f34..ba5fbc6f 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1080,7 +1080,7 @@ bridge_pick_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN], !eth_addr_is_local(iface_ea) && !eth_addr_is_reserved(iface_ea) && !eth_addr_is_zero(iface_ea) && - eth_addr_compare_3way(iface_ea, ea) < 0) + (!found_addr || eth_addr_compare_3way(iface_ea, ea) < 0)) { memcpy(ea, iface_ea, ETH_ADDR_LEN); *hw_addr_iface = iface;