[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <3c50fd47-ad7d-4b0c-9081-1b637035ef33@yunsilicon.com>
Date: Wed, 9 Apr 2025 16:08:08 +0800
From: "Xin Tian" <tianx@...silicon.com>
To: "Simon Horman" <horms@...nel.org>
Cc: <netdev@...r.kernel.org>, <leon@...nel.org>, <andrew+netdev@...n.ch>,
<kuba@...nel.org>, <pabeni@...hat.com>, <edumazet@...gle.com>,
<davem@...emloft.net>, <jeff.johnson@....qualcomm.com>,
<przemyslaw.kitszel@...el.com>, <weihg@...silicon.com>,
<wanry@...silicon.com>, <jacky@...silicon.com>,
<parthiban.veerasooran@...rochip.com>, <masahiroy@...nel.org>,
<kalesh-anakkur.purayil@...adcom.com>, <geert+renesas@...der.be>,
<geert@...ux-m68k.org>
Subject: Re: [PATCH net-next v9 14/14] xsc: add ndo_get_stats64
On 2025/3/26 18:31, Simon Horman wrote:
> On Tue, Mar 18, 2025 at 11:15:24PM +0800, Xin Tian wrote:
>
> ...
>
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/main.c b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
> ...
>
>> @@ -1912,14 +1931,20 @@ static int xsc_eth_probe(struct auxiliary_device *adev,
>> goto err_nic_cleanup;
>> }
>>
>> + adapter->stats = kvzalloc(sizeof(*adapter->stats), GFP_KERNEL);
>> + if (!adapter->stats)
> Hi Xin Tian,
>
> I think you need to set err to -ENOMEM here, else the function will return 0
> even though a memory allocation error has occurred.
>
> Flagged by Smatch (please consider running this tool on your patches).
got it, thanks
>
>> + goto err_detach;
>> +
>> err = register_netdev(netdev);
>> if (err) {
>> netdev_err(netdev, "register_netdev failed, err=%d\n", err);
>> - goto err_detach;
>> + goto err_free_stats;
>> }
>>
>> return 0;
>>
>> +err_free_stats:
>> + kvfree(adapter->stats);
>> err_detach:
>> xsc_eth_detach(xdev, adapter);
>> err_nic_cleanup:
> ...
Powered by blists - more mailing lists