From 2e265310c46de42f63298142b2caf6131feb8226 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Wed, 11 Jan 2017 08:08:05 +0100 Subject: [PATCH] Fix (bogus) MSVC 2010 warning about uninitialized variable usage in ip6.c It's wrong because the variables are initialized during first loop iteration due to best_addr == NULL --- src/core/ipv6/ip6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index 9dfd5585..ccf030bd 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -224,8 +224,11 @@ ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest) { const ip_addr_t *best_addr; const ip6_addr_t *cand_addr; - s8_t dest_scope, cand_scope, best_scope; - u8_t i, cand_pref, best_pref, cand_bits, best_bits; + s8_t dest_scope, cand_scope; + s8_t best_scope = IP6_MULTICAST_SCOPE_RESERVED; + u8_t i, cand_pref, cand_bits; + u8_t best_pref = 0; + u8_t best_bits = 0; /* Start by determining the scope of the given destination address. These * tests are hopefully (roughly) in order of likeliness to match. */