b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Anders Roxell <anders.roxell@linaro.org>,
	Sven Eckelmann <sven@narfation.org>,
	Simon Wunderlich <sw@simonwunderlich.de>
Subject: [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: fix warning in function batadv_v_elp_get_throughput
Date: Thu, 28 Mar 2019 16:31:26 +0100	[thread overview]
Message-ID: <20190328153127.19931-5-sw@simonwunderlich.de> (raw)
In-Reply-To: <20190328153127.19931-1-sw@simonwunderlich.de>

From: Anders Roxell <anders.roxell@linaro.org>

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: 7d652669b61d ("batman-adv: release station info tidstats")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/bat_v_elp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index a9b7919c9de5..d5df0114f08a 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -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) {
-- 
2.11.0


  parent reply	other threads:[~2019-03-28 15:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28 15:31 [B.A.T.M.A.N.] [PATCH 0/5] pull request for net: batman-adv 2019-03-28 Simon Wunderlich
2019-03-28 15:31 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: Reduce claim hash refcnt only for removed entry Simon Wunderlich
2019-03-28 15:31 ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: Reduce tt_local " Simon Wunderlich
2019-03-28 15:31 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: Reduce tt_global " Simon Wunderlich
2019-03-28 15:31 ` Simon Wunderlich [this message]
2019-03-28 15:31 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: Fix genl notification for throughput_override Simon Wunderlich
2019-03-28 16:51 ` [B.A.T.M.A.N.] [PATCH 0/5] pull request for net: batman-adv 2019-03-28 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190328153127.19931-5-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=anders.roxell@linaro.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sven@narfation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).