Re: [PATCH] net: hns3: fix hclge_dbg_dump_tm_pg() stack usage
From: Arnd Bergmann
Date: Tue Sep 28 2021 - 04:58:37 EST
On Tue, Sep 28, 2021 at 10:34 AM huangguangbin (A)
<huangguangbin2@xxxxxxxxxx> wrote:
> On 2021/9/27 17:49, Arnd Bergmann wrote: From: Arnd Bergmann <arnd@xxxxxxxx>
> > +static int hclge_dbg_dump_tm_pg(struct hclge_dev *hdev, char *buf, int len)
> > +{
> > + int ret;
> > + char *data_str = kcalloc(ARRAY_SIZE(tm_pg_items),
> > + HCLGE_DBG_DATA_STR_LEN, GFP_KERNEL);
> > +
> Hi Arnd, thanks your modification, according to linux code style, should the code be written as follow?
>
> char *data_str;
> int ret;
>
> data_str = kcalloc(ARRAY_SIZE(tm_pg_items),
> HCLGE_DBG_DATA_STR_LEN, GFP_KERNEL);
That's actually one of the versions I tried, but I didn't really like
any of them, so
I went with the shorter version.
Sending a v2 now with that changed black.
Arnd