Messages in this thread | | | Date | Thu, 21 Mar 2024 13:34:48 +0300 | From | Dan Carpenter <> | Subject | Re: [PATCH net] ice: Fix freeing uninitialized pointers |
| |
On Thu, Mar 21, 2024 at 10:59:42AM +0100, Przemek Kitszel wrote: > Simplest solution would be to add a macro wrapper, especially that there > are only a few deallocation methods. > > in cleanup.h: > +#define auto_kfree __free(kfree) = NULL > > and similar macros for auto vfree(), etc. > > then in the drivers: > -struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL, > *othercaps __free(kfree) = NULL; > +struct ice_aqc_get_phy_caps_data *pcaps auto_kfree, > *othercaps auto_kfree;
The auto_kfree looks like a variable to my eyes. I'd prefer something like:
#define __FREE(p) p __free(kfree) = NULL
struct ice_aqc_get_phy_caps_data *__FREE(pcaps);
regards, dan carpenter
| |