From 0d1fe4a36287a2e107f96e50a6ab3556da3726a3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 9 Sep 2011 10:12:32 -0700 Subject: [PATCH] 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. --- vswitchd/bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.30.2