mac80211: fix "warning: ‘target_metric’ may be used uninitialized"
authorJeff Mahoney <jeffm@suse.com>
Mon, 4 Apr 2016 18:15:23 +0000 (14:15 -0400)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 6 Apr 2016 13:10:25 +0000 (15:10 +0200)
This fixes:

net/mac80211/mesh_hwmp.c:603:26: warning: ‘target_metric’ may be used uninitialized in this function

target_metric is only consumed when reply = true so no bug exists here,
but not all versions of gcc realize it.  Initialize to 0 to remove the
warning.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mesh_hwmp.c

index 5b6aec1a06302c7b5efac015a5e50d5239242406..002244bca948520f9e3d722dc908c62aa3eb4fb1 100644 (file)
@@ -530,7 +530,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
        const u8 *target_addr, *orig_addr;
        const u8 *da;
        u8 target_flags, ttl, flags;
-       u32 orig_sn, target_sn, lifetime, target_metric;
+       u32 orig_sn, target_sn, lifetime, target_metric = 0;
        bool reply = false;
        bool forward = true;
        bool root_is_gate;