Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3440277pxb; Thu, 10 Feb 2022 22:48:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX1R+yZ2+/9P0oyTAiWgkwIh+8sgBlF5pcUlFnf8v6GyNeyJezpW1wKb07phx5dhO9hNVT X-Received: by 2002:a50:8e4b:: with SMTP id 11mr351217edx.445.1644562083439; Thu, 10 Feb 2022 22:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644562083; cv=none; d=google.com; s=arc-20160816; b=rNvD36t94z5MNS9oWkrwtGwGmdtZ928Rt8SZYsp4bp8/LrIoOldlr3Tqg8eTZyctZL jywwHFLfyTlFfDzbSNQTifpkt4M68O0qXFGtDxfbAAr81Pjm3IzYGUP6IwpVSvAZWr3U D7gneK//2Mdz+eqvAedA9iKTEDm4IYUpp2CHHLfSEwnuZGTMJS6X5QVXQUIXuVCs6D9a Ed7qnYHsng+rYGKdD9DER/IPXwtFn3npuLJmSuq4IhGEvdbuAxxtqx+5X5bhxNn0etFS Ou52dfZTKBzBJ3oP16WxeGlJutOJmnUiW66E/G8WZFk49XATXXHgmEXiTvP/NNjCFL6k E3ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+pExRgG4rXLcWiXKYiUDNHARsMtrh6TARwODQrx7kB0=; b=xqTBptNveSChrABATl6JKol/YC9N2vlZ2hDQCKoAANevG9/Jljdml5ZDrW3h1WQ+H6 feuP0IGqeVnNnXW3t7SVm2i5QeRxLcUst8fU6sdhXmcyfxVuLWcH5NUSj/QN3l9gpxqs /iJAbh49/PR7GbKE6iookGbF4U+piskR4FpbSqvoJeL4hrESXkWnE/AXcs6hpk07bzhu 0vhSEFjrGOEoeob9YVIMt37DDi6zPk0WFgkagohMymjgNBu2Tkod75cvVCtZdvInfipw aKqgwaSPfTPBAJeZaT9QJrCCSn+m7qAr94xYhSTOgMHXa2gdwp/nlc7pbNKO3OrpfT9Z xK3w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 4si13849220ejr.136.2022.02.10.22.47.45; Thu, 10 Feb 2022 22:48:03 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344026AbiBKCzM (ORCPT + 73 others); Thu, 10 Feb 2022 21:55:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244263AbiBKCzL (ORCPT ); Thu, 10 Feb 2022 21:55:11 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF135F4F for ; Thu, 10 Feb 2022 18:55:07 -0800 (PST) X-UUID: 2be48035695e4f7c89990aa0179393f4-20220211 X-UUID: 2be48035695e4f7c89990aa0179393f4-20220211 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 211369550; Fri, 11 Feb 2022 10:55:03 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Fri, 11 Feb 2022 10:55:02 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Feb 2022 10:55:01 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 11 Feb 2022 10:55:01 +0800 From: Deren Wu To: Felix Fietkau , Lorenzo Bianconi CC: Sean Wang , Soul Huang , YN Chen , Leon Yen , "Eric-SY Chang" , Deren Wu , KM Lin , Robin Chiu , CH Yeh , Posh Sun , Eric Liang , Stella Chang , "Evelyn Tsai" , Ryder Lee , "Shayne Chen" , linux-wireless , linux-mediatek , Deren Wu Subject: [PATCH] mt76: mt7615: fix compiler warning on frame size Date: Fri, 11 Feb 2022 10:54:55 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-MTK: N X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,MAY_BE_FORGED, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=no 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 From: Deren Wu The following error is see from the compiler: mt7615/debugfs.c: In function ‘mt7615_ext_mac_addr_read’: mt7615/debugfs.c:465:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=] The issue is due to allocating a buffer as string storage. Fix by converting to a dynamical allocation of the buffer. Reviewed-by: Ryder Lee Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7615/debugfs.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c index ca7efca1543f..250faa870db2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c @@ -443,11 +443,16 @@ mt7615_ext_mac_addr_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct mt7615_dev *dev = file->private_data; - char buf[32 * ((ETH_ALEN * 3) + 4) + 1]; + char *buf; + static u32 len = 32 * ((ETH_ALEN * 3) + 4) + 1; u8 addr[ETH_ALEN]; int ofs = 0; int i; + buf = kzalloc(len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + for (i = 0; i < 32; i++) { if (!(dev->muar_mask & BIT(i))) continue; @@ -458,10 +463,13 @@ mt7615_ext_mac_addr_read(struct file *file, char __user *userbuf, put_unaligned_le32(mt76_rr(dev, MT_WF_RMAC_MAR0), addr); put_unaligned_le16((mt76_rr(dev, MT_WF_RMAC_MAR1) & MT_WF_RMAC_MAR1_ADDR), addr + 4); - ofs += snprintf(buf + ofs, sizeof(buf) - ofs, "%d=%pM\n", i, addr); + ofs += snprintf(buf + ofs, len - ofs, "%d=%pM\n", i, addr); } - return simple_read_from_buffer(userbuf, count, ppos, buf, ofs); + ofs = simple_read_from_buffer(userbuf, count, ppos, buf, ofs); + + kfree(buf); + return ofs; } static ssize_t -- 2.18.0