Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2572826yba; Mon, 6 May 2019 08:11:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzggx4Wl/yK3fwGxFDIdZXGHJnYBt6Aqok7BsicleqbTw4ug+f0z0IYKNw0FQDcU2Pu1v2t X-Received: by 2002:a17:902:e00a:: with SMTP id ca10mr2349696plb.18.1557155469554; Mon, 06 May 2019 08:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155469; cv=none; d=google.com; s=arc-20160816; b=bAWVNSOnXisw5y9DveKakXkuiKtb5OzVgBqW/dZWYwj8FPeJiFTzAP2mpvcolbLsRQ ASSUCg0s42xLlosFyhy0BXfTu98zegXeyZpoJE9aRmSPwq37h3hJzqzEnCU7HgFeWZT7 dR06ucnxQEPzuMFPu2dWtMgwEJMhIVVIfZPKgXJMT8nmzND88heEX3juxAByNZ8S0gpJ Nx6/o3V6J3emS8NmU1w2ZzGTH19aR5FBMMOuFaCdGfVPIUaE++FJTQPSeLSaQZ0knAhR Vr/l2rrd1M5mej43Z9ePj8FgBkgqFZfPGGm1lUjTImn3JXS/7j2oslLIkcONxYZmvcQR gu5A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ktCLpuYZzVbjmjVYzRIhEQHK94PymJ+/H5omgNJDCAA=; b=TnM7TY3R36y4qz3dcdqC6ZwNQ2f4IhHf24GFNpwOQjluUxHEOtkbs2dCbbwu4T7cU7 pNYUbZLdw9pVp3KI21n7bJ48ZcRCdn/CVIfKFR12/+8oZDKcTpYwHKMIAiKvGp0rgq1k jnA3StDKmduGDhP7SG7YiOzBlJPlqhICNJRo4E2FIj0RFsyKBqTbRxRP2ht28t+KkE8X gnTSBozsgMGk7ua0Nixw49G4Qx6pYNAzs7rrTsBWFEVQTSav491Oyblvsc9Y7Zwzgsev 66NPR0b33cH0TA7y5NxpSAPxM/pi6NuXH8AYmcsIPVGD6C9TqqxJqOyuiNFOSCtUkYlg 6edw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cLxdd341; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 a3si7061830plp.435.2019.05.06.08.10.53; Mon, 06 May 2019 08:11:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cLxdd341; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727150AbfEFPJ7 (ORCPT + 99 others); Mon, 6 May 2019 11:09:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:54744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbfEFOex (ORCPT ); Mon, 6 May 2019 10:34:53 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9AF5321019; Mon, 6 May 2019 14:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153293; bh=Yeqnq9wqzkXwsILmGMrqCRPypzLqPm22FhFs/Y+2jAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLxdd341+oYHsIkk9XP/wNlHgINKdIZtrRIZS6rGwgMm1eGHivqOZDZZ6TZdcva38 bwL3/9PUTCcLjZLKDZNscE9ZYvD52Yyub9kZeqfgsqnrOF4+vm6HrMjCVoCKysmx5J CsTOu42f/b7lFKoZbmX+CuZI2x2JFCXoZhK1L6yQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Roxell , Sven Eckelmann , Simon Wunderlich , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 035/122] batman-adv: fix warning in function batadv_v_elp_get_throughput Date: Mon, 6 May 2019 16:31:33 +0200 Message-Id: <20190506143058.023548344@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ca8c3b922e7032aff6cc3fd05548f4df1f3df90e ] 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 Signed-off-by: Sasha Levin (Microsoft) --- 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 ef0dec20c7d8..5da183b2f4c9 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.20.1