Re: [PATCH] cxgb4: fix memory leak in cxgb4_init_ethtool_filters() error path

From: Markus Elfring
Date: Fri Apr 11 2025 - 14:51:01 EST


> 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