[Intel-wired-lan] [RFT net-next PATCH RESEND 0/2] ethernet: intel: fix freeing uninitialized pointers with __free

Tony Nguyen anthony.l.nguyen at intel.com
Tue Dec 2 18:17:08 UTC 2025



On 12/2/2025 11:47 AM, ally heev wrote:
> On Mon, 2025-12-01 at 13:40 -0800, Tony Nguyen wrote:
>>
>> On 11/23/2025 11:40 PM, Ally Heev wrote:
>>> Uninitialized pointers with `__free` attribute can cause undefined
>>> behavior as the memory assigned randomly to the pointer is freed
>>> automatically when the pointer goes out of scope.
>>>
>>> We could just fix it by initializing the pointer to NULL, but, as usage of
>>> cleanup attributes is discouraged in net [1], trying to achieve cleanup
>>> using goto
>>
>> These two drivers already have multiple other usages of this. All the
>> other instances initialize to NULL; I'd prefer to see this do the same
>> over changing this single instance.
>>
> 
> Other usages are slightly complicated to be refactored and might need
> good testing. Do you want me to do it in a different series?

Hi Ally,

Sorry, I think I was unclear. I'd prefer these two initialized to NULL, 
to match the other usages, over removing the __free() from them.

Thanks,
Tony

> Regards,
> Ally



More information about the Intel-wired-lan mailing list