[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d9189c94-31c0-42d9-aa9b-60871cf6b285@web.de>
Date: Fri, 11 Apr 2025 20:50:07 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Abdun Nihaal <abdun.nihaal@...il.com>, Simon Horman <horms@...nel.org>,
netdev@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Potnuri Bharat Teja <bharat@...lsio.com>,
Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>,
Vishal Kulkarni <vishal@...lsio.com>
Subject: Re: [PATCH] cxgb4: fix memory leak in cxgb4_init_ethtool_filters()
error path
> I think what Markus meant, was to move the ret = -ENOMEM from both the
> allocations in the loop, to after the free_eth_finfo label because it is
> -ENOMEM on both goto jumps.
Exactly, I find this a reasonable source code transformation for another update step.
> But personally I would prefer having the ret code right after the call
> that is failing. Also I would avoid creating new goto labels unless
> necessary, because it is easier to see the kvfree in context inside the
> loop, than to put it in a separate label.
How will development views evolve further here?
> I just tried to make the most minimal code change to fix the memory leak.
This approach is generally appropriate.
Regards,
Markus
Powered by blists - more mailing lists