From patchwork Thu Mar 28 15:31:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 161324 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp870337jan; Thu, 28 Mar 2019 08:40:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqz33Ka3tvrLoIRTHWNx+oU9SQ5AHPtjvwMCJDdUxamTvToBx3Q7HqFwqejSVbLmu6G8Sqao X-Received: by 2002:a63:29c8:: with SMTP id p191mr32780207pgp.197.1553787609424; Thu, 28 Mar 2019 08:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553787609; cv=none; d=google.com; s=arc-20160816; b=oxF6JPpge0lz4+P8Z+PIOh1zYPkal5RJi9haxwDrTTA2wimy4h6yCrHMicgl4KfB0E LMJrURu/Fr/CmwbRqFDTkfbgExm6imW5gNQ7S0ZYnXJdCXgpsygUJG/EliqwXTMO4gja B8qc39rQdmakdNmFn2WxKSxYevjSBPmnENEdULZ/rsCu/e8xBqe4EuvvKvAfuoVrd16i KSmLMjdPOLFiYrxoleNC8LSRHAyy8BWShy/8+AxkHlZVpE1lLzX5p2P3Sc1c+7vD0hEh lT43ukiRwb3sPqJ3u3k50/Cex+z7YL31qDctDtu+IhmaF1NdXV9yhazGpbRbYcTVmZYg ySog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MNPP5NsQNgaScaZSr5iRuThphqBc9QR9qTfx1ZVJrdA=; b=MqcSlC2qMS0O+hAeRMhoSuwTDU0zPolOF79rSK+WrHZTEv0PkO1IjKpXLEBLBQOABF 4IYVVsSsx0keUTTmEJlA1eoTyIW1VtLosUclFx8T6Dk058sN/F7Q57FalPqMuS5AhWO0 VyZMRet1rHtJjXdipBPkVVBuYorwfvJ0DvKxlkJFiwzT6Q/lWJd1U2WZi3Jxngy9F4uR E6LXMqLRMh5Y5Qm+/WFVGIkvhxCVRbNEcBO/ag2//nLi7BPMLDfoeZW/Xhg63ig6M8yw J4uB1v5sugz2bmyICezk+NaCTMaoaoq+sumv5RFxn+SzGirzpOBUQ6SwVG1l4/0o1/zS Wg5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si10777825plr.131.2019.03.28.08.40.09; Thu, 28 Mar 2019 08:40:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727643AbfC1PkI (ORCPT + 9 others); Thu, 28 Mar 2019 11:40:08 -0400 Received: from packetmixer.de ([79.140.42.25]:50054 "EHLO mail.mail.packetmixer.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727500AbfC1PkH (ORCPT ); Thu, 28 Mar 2019 11:40:07 -0400 X-Greylist: delayed 517 seconds by postgrey-1.27 at vger.kernel.org; Thu, 28 Mar 2019 11:40:07 EDT Received: from kero.packetmixer.de (unknown [IPv6:2001:16b8:5521:6300:1885:7807:d2cf:4308]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mail.packetmixer.de (Postfix) with ESMTPSA id 3458B62071; Thu, 28 Mar 2019 16:31:33 +0100 (CET) From: Simon Wunderlich To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Anders Roxell , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 4/5] batman-adv: fix warning in function batadv_v_elp_get_throughput Date: Thu, 28 Mar 2019 16:31:26 +0100 Message-Id: <20190328153127.19931-5-sw@simonwunderlich.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190328153127.19931-1-sw@simonwunderlich.de> References: <20190328153127.19931-1-sw@simonwunderlich.de> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Anders Roxell 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 Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/bat_v_elp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.11.0 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) {