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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 5 May 2015 20:26:22 +0000
From:	Jose Rivera <German.Rivera@...escale.com>
To:	Scott Wood <scottwood@...escale.com>
CC:	Dan Carpenter <dan.carpenter@...cle.com>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"agraf@...e.de" <agraf@...e.de>, "arnd@...db.de" <arnd@...db.de>,
	"bhupesh.sharma@...escale.com" <bhupesh.sharma@...escale.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Stuart Yoder <stuart.yoder@...escale.com>,
	"nir.erez@...escale.com" <nir.erez@...escale.com>,
	"itai.katz@...escale.com" <itai.katz@...escale.com>,
	"bhamciu1@...escale.com" <bhamciu1@...escale.com>,
	"R89243@...escale.com" <R89243@...escale.com>,
	Richard Schmitt <richard.schmitt@...escale.com>
Subject: RE: [PATCH 1/7] staging: fsl-mc: MC bus IRQ support



> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, May 05, 2015 2:42 PM
> To: Rivera Jose-B46482
> Cc: Dan Carpenter; devel@...verdev.osuosl.org; agraf@...e.de;
> arnd@...db.de; Sharma Bhupesh-B45370; gregkh@...uxfoundation.org; linux-
> kernel@...r.kernel.org; Yoder Stuart-B08248; Erez Nir-RM30794; katz Itai-
> RM05202; Hamciuc Bogdan-BHAMCIU1; Marginean Alexandru-R89243; Schmitt
> Richard-B43082
> Subject: Re: [PATCH 1/7] staging: fsl-mc: MC bus IRQ support
> 
> On Tue, 2015-05-05 at 11:08 -0500, Rivera Jose-B46482 wrote:
> > > > > to read what "goto error;" does.  The error handling here calls
> > > > > devm_kfree() which is not needed...  devm_ functions
> > > > > automatically clean up after themselves.  This seems a pattern
> > > > > throughout.  Do a search for
> > > > > devm_free() and see which ones are really needed or not.
> > > > >
> > > > I know that memory allocated with devm_kzalloc() is freed at the
> > > > end of the lifetime of the device it is attached to. However, in
> > > > error paths, why wait until the device is destroyed? Why not free
> > > > the memory earlier so that it can be used for other purposes?
> > >
> > Why then do the devm_kfree() function exist?
> >
> > I will not remove the devm_free() calls unless the upstream maintainer
> > requires me to do so.
> 
> The whole point of devm is to simplify (often poorly tested) error paths.
> You're trying to optimize the error path instead of simplify it, which
> doesn't make sense.
> 
> devm_kfree() is for the uncommon case when you want to free the memory in
> a situation where the device isn't being unbound any time soon, but you
> still want the memory to be handled by devm for some reason.
> 
> Most users of devm_kzalloc() do not use devm_kfree():
> scott@...tra:~/fsl/git/linux/upstream$ git grep devm_kzalloc|wc -l
> 2750
> scott@...tra:~/fsl/git/linux/upstream$ git grep devm_kfree|wc -l
> 118
> 
Ok, I'll remove the devm_kfree() calls.

Thanks,

German

> -Scott
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ