Re: [PATCH net] ice: Fix freeing uninitialized pointers
From: Jakub Kicinski
Date: Tue Mar 19 2024 - 15:43:30 EST
On Sat, 16 Mar 2024 12:44:40 +0300 Dan Carpenter wrote:
> - struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
> - void *mac_buf __free(kfree);
> + struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
> + void *mac_buf __free(kfree) = NULL;
This is just trading one kind of bug for another, and the __free()
magic is at a cost of readability.
I think we should ban the use of __free() in all of networking,
until / unless it cleanly handles the NULL init case.