[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zfx2VL7xnj4rQoV8@smile.fi.intel.com>
Date: Thu, 21 Mar 2024 20:03:00 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Dan Carpenter <dan.carpenter@...aro.org>,
kernel-janitors@...r.kernel.org, netdev@...r.kernel.org,
intel-wired-lan@...ts.osuosl.org,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
Alexander Lobakin <aleksander.lobakin@...el.com>,
David Laight <David.Laight@...lab.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Jiri Pirko <jiri@...nulli.us>, Jonathan Cameron <jic23@...nel.org>,
Julia Lawall <julia.lawall@...ia.fr>,
Kees Cook <keescook@...omium.org>,
Lukasz Czapnik <lukasz.czapnik@...el.com>,
Paolo Abeni <pabeni@...hat.com>,
Pucha Himasekhar Reddy <himasekharx.reddy.pucha@...el.com>
Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers
On Thu, Mar 21, 2024 at 06:59:00PM +0100, Markus Elfring wrote:
…
> > +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> > @@ -941,11 +941,11 @@ static u64 ice_loopback_test(struct net_device *netdev)
> > struct ice_netdev_priv *np = netdev_priv(netdev);
> > struct ice_vsi *orig_vsi = np->vsi, *test_vsi;
> > struct ice_pf *pf = orig_vsi->back;
> > + u8 *tx_frame __free(kfree) = NULL;
> > u8 broadcast[ETH_ALEN], ret = 0;
> > int num_frames, valid_frames;
> > struct ice_tx_ring *tx_ring;
> > struct ice_rx_ring *rx_ring;
> > - u8 *tx_frame __free(kfree);
> > int i;
> >
> > netdev_info(netdev, "loopback test\n");
>
> How do you think about to reduce the scope for the affected local variable instead
> with the help of a small script (like the following) for the semantic patch language?
>
> @movement@
> attribute name __free;
> @@
> -u8 *tx_frame __free(kfree);
> int i;
> ... when any
> if (ice_fltr_add_mac(test_vsi, ...))
> { ... }
> +
> +{
> +u8 *tx_frame __free(kfree) = NULL;
> if (ice_lbtest_create_frame(pf, &tx_frame, ...))
> { ... }
> ... when any
> +}
> +
> valid_frames = ice_lbtest_receive_frames(...);
I believe you don't understand what the scope of the above can be.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists