Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2756815rdb; Mon, 4 Dec 2023 06:51:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxfXo+iYfwu1Y9wK3mWZgVngAeoAwqIFgEkV/bT60/uhmJlfUUzNlNHiR7TBVeaeItzUSz X-Received: by 2002:a17:903:495:b0:1d0:6ffd:cea1 with SMTP id jj21-20020a170903049500b001d06ffdcea1mr1741424plb.90.1701701469225; Mon, 04 Dec 2023 06:51:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701701469; cv=none; d=google.com; s=arc-20160816; b=K4QHXDhc6luSiUyQKpGXD+hBmsbtTIb2RAZd9ynyrWYDpmsQDexlibH4ftk8J7dkGT IPPgMyPiaf69tML5rewrEozJ33R87gyA+47YQ0/lGZ+nAcsSiFQcNJmmqV/6ABMzVgVQ QhgxHlmKfgo0jZaLOaUqjDm+59N7ITb60yRzaRJIxd7gqhFTfnyRmewnG+kIYBdnQ+5G zA2qxCdgEOAxQa4TcJxGkbeT3cJUNHG+JCXpWy0cmHOwnVRKf8Kzh0Eehq2ZHhUYubc1 NOwyYDxd7BjjrSx/WHYwsP95uiEWfLfs2Xnt4ecO5QJq2wng6pOcUUPhoxmolvIikegW 83nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:subject:cc:user-agent:mime-version:date:message-id; bh=OGqYrZETDObOh+9Zn5X1uz35QQe2R7E7EKKPWT/+JMI=; fh=iYi3YJtN3aCOHsi1UQZQg9Z3pSqNALve9c0GrbOpYp8=; b=ZD0V2c7zS+KvuCViMqiJEUybb7W4ASizIEuWv1EFp/LCuoZgt8jPkfb45jNSz04k8G JbiAiQqUReLi/JPcJ6IvoeQPTt71+mk/yCdslUjQsM7n5QX9Q9ILkwNrCkHxPmEwCsV4 N8kQFjj+3R63vdW9aRDOyPZ3Yiv8A/IN5XMTjBCkSU8jb6UNFtfDW6F6OAgP6apYUafI CJtcDkpuaTsp5dTOlP5dNTTbcRdGk7lrAPspymO1MS256oKcy7CplIgxeQCbaXytYbAO OlNhXONnn2yc+erfThMkV/raMo2W9eM4050c7jpO7NcNK6R7z1nHHl+FiA8OntyXwaeE HSpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id z6-20020a170903018600b001d09c8c44dfsi1921386plg.627.2023.12.04.06.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 06:51:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D6209808A954; Mon, 4 Dec 2023 06:51:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234390AbjLDOux (ORCPT + 99 others); Mon, 4 Dec 2023 09:50:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233871AbjLDOuv (ORCPT ); Mon, 4 Dec 2023 09:50:51 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EAC5D3; Mon, 4 Dec 2023 06:50:58 -0800 (PST) Received: from kwepemm000007.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SkRLz181JzShMs; Mon, 4 Dec 2023 22:46:35 +0800 (CST) Received: from [10.67.120.192] (10.67.120.192) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 4 Dec 2023 22:50:55 +0800 Message-ID: <7df7cfcb-d39b-4643-a378-a18b8d2b5b35@huawei.com> Date: Mon, 4 Dec 2023 22:50:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird CC: , Arnd Bergmann , Hao Chen , , Subject: Re: [PATCH] [v2] net: hns3: reduce stack usage in hclge_dbg_dump_tm_pri() To: Arnd Bergmann , Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni References: <20231204085735.4112882-1-arnd@kernel.org> From: Jijie Shao In-Reply-To: <20231204085735.4112882-1-arnd@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.120.192] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm000007.china.huawei.com (7.193.23.189) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 06:51:07 -0800 (PST) on 2023/12/4 16:57, Arnd Bergmann wrote: > s already allocated by debugfs, > but that is a much larger change. > > Signed-off-by: Arnd Bergmann > --- > v2: fix error handling leak > --- > .../hisilicon/hns3/hns3pf/hclge_debugfs.c | 21 ++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c > index ff3f8f424ad9..8f94e13c1edf 100644 > --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c > @@ -981,7 +981,7 @@ static const struct hclge_dbg_item tm_pri_items[] = { > > static int hclge_dbg_dump_tm_pri(struct hclge_dev *hdev, char *buf, int len) > { > - char data_str[ARRAY_SIZE(tm_pri_items)][HCLGE_DBG_DATA_STR_LEN]; > + char *data_str; We want to define variables in an inverted triangle based on the code length. so, "char *data_str" should move four lines down. struct hclge_tm_shaper_para c_shaper_para, p_shaper_para; char *result[ARRAY_SIZE(tm_pri_items)], *sch_mode_str; char content[HCLGE_DBG_TM_INFO_LEN]; u8 pri_num, sch_mode, weight, i, j; char *data_str; int pos, ret; > struct hclge_tm_shaper_para c_shaper_para, p_shaper_para; > char *result[ARRAY_SIZE(tm_pri_items)], *sch_mode_str; > char content[HCLGE_DBG_TM_INFO_LEN]; > @@ -992,8 +992,13 @@ static int hclge_dbg_dump_tm_pri(struct hclge_dev *hdev, char *buf, int len) > if (ret) > return ret; >