lkml.org 
[lkml]   [2024]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2024-05-27 15:57    [W:0.049 / U:0.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site