lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 31 May 2023 09:36:32 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: intel-wired-lan-bounces@...osl.org,
	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Tony Nguyen <anthony.l.nguyen@...el.com>,
	Anirudh Venkataramanan <anirudh.venkataramanan@...el.com>,
	Victor Raj <victor.raj@...el.com>,
	Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
	Jacob Keller <jacob.e.keller@...el.com>,
	Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@...ux.intel.com>,
	Michal Wilczynski <michal.wilczynski@...el.com>,
	netdev@...r.kernel.org
Subject: Re: [PATCH iwl-next] ice: remove null checks before devm_kfree()
 calls

On Wed, May 31, 2023 at 12:06:15AM +0200, Przemek Kitszel wrote:
> On 5/30/23 20:10, Simon Horman wrote:
> > On Tue, May 30, 2023 at 01:25:49PM +0200, Przemek Kitszel wrote:
> > > We all know they are redundant.
> > > 
> > > Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
> > > Reviewed-by: Michal Wilczynski <michal.wilczynski@...el.com>
> > > Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> > 
> > ...
> > 
> > > diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c
> > > index ef103e47a8dc..85cca572c22a 100644
> > > --- a/drivers/net/ethernet/intel/ice/ice_flow.c
> > > +++ b/drivers/net/ethernet/intel/ice/ice_flow.c
> > > @@ -1303,23 +1303,6 @@ ice_flow_find_prof_id(struct ice_hw *hw, enum ice_block blk, u64 prof_id)
> > >   	return NULL;
> > >   }
> > > -/**
> > > - * ice_dealloc_flow_entry - Deallocate flow entry memory
> > > - * @hw: pointer to the HW struct
> > > - * @entry: flow entry to be removed
> > > - */
> > > -static void
> > > -ice_dealloc_flow_entry(struct ice_hw *hw, struct ice_flow_entry *entry)
> > > -{
> > > -	if (!entry)
> > > -		return;
> > > -
> > > -	if (entry->entry)
> > > -		devm_kfree(ice_hw_to_dev(hw), entry->entry);
> > > -
> > > -	devm_kfree(ice_hw_to_dev(hw), entry);
> > > -}
> > > -
> > >   /**
> > >    * ice_flow_rem_entry_sync - Remove a flow entry
> > >    * @hw: pointer to the HW struct
> > > @@ -1335,7 +1318,8 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, enum ice_block __always_unused blk,
> 
> More context would include following:
> 
>         if (!entry)
>                 return -EINVAL;
> 
> 
> > >   	list_del(&entry->l_entry);
> > > -	ice_dealloc_flow_entry(hw, entry);
> > > +	devm_kfree(ice_hw_to_dev(hw), entry->entry);
> > 
> > Hi Przemek,
> > 
> > Previously entry was not dereferenced if it was NULL.
> > Now it is. Can that occur?
> 
> The check is right above the default 3-line context provided by git, see
> above.

Yes, right. Sorry for not checking that.
This does of course look good.

Reviewed-by: Simon Horman <simon.horman@...igine.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ