[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <22ba28d7-e8ed-4b5a-9b6f-42d944d2f67d@moroto.mountain>
Date: Thu, 21 Mar 2024 13:34:48 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Alexander Lobakin <aleksander.lobakin@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Kees Cook <keescook@...omium.org>,
David Laight <David.Laight@...lab.com>,
"Czapnik, Lukasz" <lukasz.czapnik@...el.com>
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
Powered by blists - more mailing lists