From patchwork Fri Feb 22 15:25:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 17833 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 5D5FD81485; Fri, 22 Feb 2019 19:28:55 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WXNotICH"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::244; helo=mail-lj1-x244.google.com; envelope-from=anders.roxell@linaro.org; receiver= Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by open-mesh.org (Postfix) with ESMTPS id 162AF8029A for ; Fri, 22 Feb 2019 16:25:57 +0100 (CET) Received: by mail-lj1-x244.google.com with SMTP id j13-v6so2028771ljc.2 for ; Fri, 22 Feb 2019 07:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uFbrY32NXUwup51qKdt/oIHZov4twGH23PmbEaftP40=; b=WXNotICHc85DVsqB0RFUEdDKvFzYnweGa08nK+8iCeM+OBTuuWlLi0sJGOHqCqvrrQ uzwGQbK4x+L889I7caEjO7EPQ2+Hv9Z51uvvlFlVdkNVD0E+F0r36QfTN6yTT6tRcyyC ukfMFuiQdnM9ikeOFcpAY30qa6wf7mK96dki/N5wY8i2P3Qz2KWhyOyYv3XFzPSrKh2K zXzGJf9mewgl6DqQOTht8eNLNaue87ZsV6453g8rFBlgS7k/nG5H8z+lDsrxYYYOYNdb w/r24OEuD6gtBUaO8rc7BMSTqFQmQtY7YHoi6W1v9yTtMKonkebYXeKHp0vwOQE+ArF9 qcFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uFbrY32NXUwup51qKdt/oIHZov4twGH23PmbEaftP40=; b=Y2jwrynAtXYIOKndWcn0DXyv0t23VgcoFg8oaGWA6dL6gxc1V/QpxBs1kdh6Q4QhQl q3BhCdYPgg8l8RuMTyguABTwjydWKJobmp6CpKOH9F26/H1WZ7h95iJxInc8nS+s/iGY zgkO8lyuigsZjNqYB4S+h+gxuL92PGE26l1NhF7AYwD6p9mxhaI3BCwFVNxQbWyAOiSN mZS2fds2/d/488yd6AkCnHfOai23mfNtNRJZvZf7vRdOUs2KM0pHo2qUEr5i2EvSeA0j GP7RUSrpTWE5llC45ZMGffsGhj5rY4xUOnR9vgRbLXiegSkpykq9v322T4Dgl5SkUe/3 /Y2g== X-Gm-Message-State: AHQUAuZCx7PSopsNItQT2UH+O8KYk7BVaM33zd6eHxt+k3sNXhD7f6OJ KgWduxgUu8q2itTwGHO5fe/Zxw== X-Google-Smtp-Source: AHgI3IZK1H3fL+Ht/MlRCv0jSWpnFf6U7dZ1Dp9vUfvUgguco6YmdDZXIAQ/lhMJkwsG1yF5k/rrkw== X-Received: by 2002:a2e:6309:: with SMTP id x9mr2601367ljb.75.1550849156868; Fri, 22 Feb 2019 07:25:56 -0800 (PST) Received: from localhost (c-573670d5.07-21-73746f28.bbcust.telenor.se. [213.112.54.87]) by smtp.gmail.com with ESMTPSA id r80sm624932lff.33.2019.02.22.07.25.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 07:25:56 -0800 (PST) From: Anders Roxell To: mareklindner@neomailbox.ch, sw@simonwunderlich.de, a@unstable.cc, davem@davemloft.net Date: Fri, 22 Feb 2019 16:25:54 +0100 Message-Id: <20190222152554.30006-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 22 Feb 2019 19:28:53 +0100 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: fix warning in function batadv_v_elp_get_throughput X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Anders Roxell , linux-kernel@vger.kernel.org Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" 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. Signed-off-by: Anders Roxell --- 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) {