Skip to content

Commit

Permalink
batman-adv: fix warning in function batadv_v_elp_get_throughput
Browse files Browse the repository at this point in the history
When CONFIG_CFG80211 isn't enabled the compiler correcly warns about
'sinfo.pertid' may be unused. It can also happen for other error
conditions that it not warn about.

net/batman-adv/bat_v_elp.c: In function ‘batadv_v_elp_get_throughput.isra.0’:
include/net/cfg80211.h:6370:13: warning: ‘sinfo.pertid’ may be used
 uninitialized in this function [-Wmaybe-uninitialized]
  kfree(sinfo->pertid);
        ~~~~~^~~~~~~~

Rework so that we only release '&sinfo' if cfg80211_get_station returns
zero.

Fixes: 7d65266 ("batman-adv: release station info tidstats")
Signed-off-by: Anders Roxell <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Signed-off-by: Simon Wunderlich <[email protected]>
  • Loading branch information
roxell authored and simonwunderlich committed Mar 25, 2019
1 parent f131a56 commit ca8c3b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/batman-adv/bat_v_elp.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)

ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo);

/* free the TID stats immediately */
cfg80211_sinfo_release_content(&sinfo);
if (!ret) {
/* free the TID stats immediately */
cfg80211_sinfo_release_content(&sinfo);
}

dev_put(real_netdev);
if (ret == -ENOENT) {
Expand Down

0 comments on commit ca8c3b9

Please sign in to comment.