Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2989972rwb; Fri, 2 Dec 2022 19:27:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5peY8dXz1iQ3km69EC9xyWgTlIvJwMOeOnVOlhx/yqT5G/AMv0fJiamk+3SfKKABMjS9Pr X-Received: by 2002:a17:90a:ea04:b0:219:9da1:6088 with SMTP id w4-20020a17090aea0400b002199da16088mr3125232pjy.64.1670038077335; Fri, 02 Dec 2022 19:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670038077; cv=none; d=google.com; s=arc-20160816; b=xZWKf0YZJsKLzJTqCjvdWCmKfVZ6iDx+TRnaGtA2wLiOlrwrAXkGMT1mDQWoxd8/Ir AD2Cr/MvJIGQs09IHrUu1eLsz2O2S2D5wUB7Fwp5Q0+XYm49RrE3VWTCgsMd5rfDAPkc tuNgCS25q/j93osjcsfhFlCokXiAuQ0DVmEtc17iaQR0anJSfSCC3XrpC3Z0WJjyIyFx hombstZaOTymAOUMTma6eMD4v4MD44MPQfPYLcG9e9ZhtX5283WMoi28GHiHp3rKndg8 2d4fFh4v2hHOe94BPg60coN9GXjiRtvNNzjJ6wyMrEycGb536tLZSES6ONJkJarml2tV 0neQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=F3N+BXWVouR7PHRflmwklN0n51QgK3XV+XrOP4kaVCk=; b=rrFzWI9P2oNFmzekLQjYQpV1G1bSsodgwuvKO7enNe9IQ9Y6RJRMsRqs1cDxRgGmG7 KxuUb7sEtoBGriPpLwFXe7gkcB436HXIqPTGL1B9MEcRbJ65fNitjDOTk1eQkusMpjfM ytkzkdgsATocbgXYbqfhzWJ3gtogoETJ3tmTU699eLuBPIHXbBvcvDpYDPWkS9mwCmz8 CJQNHeRZE1lKLfb6Tx30RFJUzWOIkXmxxNLaEeFt/6QdVc45lOmMb0TPkBh4hbP5KODz OXci87W0FdpJuzXO15L18GPfg3u6PSoIKuurPNc1jaq8ZLymCaFsl+rL8fGC+Rqenq3h Ur5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ag9+AMTP; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k29-20020a634b5d000000b004786a8301c3si8277658pgl.586.2022.12.02.19.27.49; Fri, 02 Dec 2022 19:27:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ag9+AMTP; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230042AbiLCDWo (ORCPT + 66 others); Fri, 2 Dec 2022 22:22:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiLCDWk (ORCPT ); Fri, 2 Dec 2022 22:22:40 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5509F7A for ; Fri, 2 Dec 2022 19:22:36 -0800 (PST) X-UUID: 621310b373df4458a468c18ccea0f619-20221203 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=F3N+BXWVouR7PHRflmwklN0n51QgK3XV+XrOP4kaVCk=; b=ag9+AMTPWlSZ1l3aqzbiOYyHGEIT5lonwEVfMEthAp7zXliU7CKmU4dHc2Pf8e9PrIr8RVpUPIkACLXx65+S0hbP5B9pZiTqMP3SH9DGYT49logRN56S4A4opyrMT8PAzy//2TBHE++y5QhQoRzh0fYl5WDTmU/x9qsv5iY4teg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:f116ad4c-9b3d-4cef-9cce-e88877434a03,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:dcaaed0,CLOUDID:4edc061f-5e1d-4ab5-ab8e-3e04efc02b30,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 621310b373df4458a468c18ccea0f619-20221203 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1000535550; Sat, 03 Dec 2022 11:22:27 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Sat, 3 Dec 2022 11:22:26 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sat, 3 Dec 2022 11:22:26 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH 1/4] wifi: mt76: mt7915: fix mt7915_rate_txpower_get() resource leaks Date: Sat, 3 Dec 2022 11:22:22 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Coverity message: variable "buf" going out of scope leaks the storage. Reported-by: coverity-bot Addresses-Coverity-ID: 1527799 ("Resource leaks") Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support") Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index fb46c2c1784f..a7fdcd1f3d98 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -996,7 +996,7 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf, ret = mt7915_mcu_get_txpower_sku(phy, txpwr, sizeof(txpwr)); if (ret) - return ret; + goto out; /* Txpower propagation path: TMAC -> TXV -> BBP */ len += scnprintf(buf + len, sz - len, @@ -1047,6 +1047,8 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf, mt76_get_field(dev, reg, MT_WF_PHY_TPC_POWER)); ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); + +out: kfree(buf); return ret; } -- 2.18.0