* Re: question regarding drivers/staging/iio/adc/ad7280a.c [not found] <CAB78YHwneVuVBPujeKE=rEygvtyn=VvtLtd75+pvwqxPxYcB6g@mail.gmail.com> @ 2014-07-15 17:31 ` Jonathan Cameron 2014-07-16 11:14 ` Lars-Peter Clausen 0 siblings, 1 reply; 4+ messages in thread From: Jonathan Cameron @ 2014-07-15 17:31 UTC (permalink / raw) To: Himangi Saraogi, Greg Kroah-Hartman, linux-iio, devel, linux-kernel Cc: Julia Lawall, Lars-Peter Clausen On 14/07/14 21:31, Himangi Saraogi wrote: > Hi, > > The code seems to have a memory leak. The function ad7280_attr_init > calls kasprintf a number of times, which calls kmalloc (or more > precisely kmalloc_track_caller), but this data does not ever seem to > be freed. I propose to introduce a devm_ version of kasprintf, which > will be useful for other files also. I am not very sure that will it > be useful to introduce a bunch of kfrees, just to remove the memory > leaks immediately, but I think it would be safer just to devm > everything, so then one is sure that everything is freed as it should > be, in the right order. > The question here is whether such a memory leak squashing would be worth applying to stable. Personally I'd go with no. In which case feel free to fix it via the introduction of a devm version. Jonathan > Thanks > Himangi ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: question regarding drivers/staging/iio/adc/ad7280a.c 2014-07-15 17:31 ` question regarding drivers/staging/iio/adc/ad7280a.c Jonathan Cameron @ 2014-07-16 11:14 ` Lars-Peter Clausen [not found] ` <CAB78YHzEPZf-8m0zwFz5PZWkqMuX9m5W01f2JGQ+7MbAkTACPg@mail.gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Lars-Peter Clausen @ 2014-07-16 11:14 UTC (permalink / raw) To: Jonathan Cameron, Himangi Saraogi, Greg Kroah-Hartman, linux-iio, devel, linux-kernel Cc: Julia Lawall On 07/15/2014 07:31 PM, Jonathan Cameron wrote: > On 14/07/14 21:31, Himangi Saraogi wrote: >> Hi, >> >> The code seems to have a memory leak. The function ad7280_attr_init >> calls kasprintf a number of times, which calls kmalloc (or more >> precisely kmalloc_track_caller), but this data does not ever seem to >> be freed. I propose to introduce a devm_ version of kasprintf, which >> will be useful for other files also. I am not very sure that will it >> be useful to introduce a bunch of kfrees, just to remove the memory >> leaks immediately, but I think it would be safer just to devm >> everything, so then one is sure that everything is freed as it should >> be, in the right order. >> > The question here is whether such a memory leak squashing would be > worth applying to stable. Personally I'd go with no. In which case > feel free to fix it via the introduction of a devm version. devm is probably fine here. The long term fix should be to switch the driver to use iio_chan_spec_ext_info infrastructure which will handle the allocation and freeing internally in the IIO framework. - Lars ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAB78YHzEPZf-8m0zwFz5PZWkqMuX9m5W01f2JGQ+7MbAkTACPg@mail.gmail.com>]
* Re: question regarding drivers/staging/iio/adc/ad7280a.c [not found] ` <CAB78YHzEPZf-8m0zwFz5PZWkqMuX9m5W01f2JGQ+7MbAkTACPg@mail.gmail.com> @ 2014-07-17 20:58 ` Greg Kroah-Hartman 2014-07-18 1:27 ` Greg Kroah-Hartman 0 siblings, 1 reply; 4+ messages in thread From: Greg Kroah-Hartman @ 2014-07-17 20:58 UTC (permalink / raw) To: Himangi Saraogi Cc: Lars-Peter Clausen, Jonathan Cameron, linux-iio, devel, linux-kernel, Julia Lawall On Thu, Jul 17, 2014 at 11:40:04PM +0530, Himangi Saraogi wrote: > Hi, > > I have sent in a patch for adding devm_kasprintf https://lkml.org/lkml/2014/7/ > 16/667. > I will be updating this file and send in a patch once it is accepted. Was it > the right thing > to do to send the devm_kasprintf patch separately from the patch on the file to > use it for, > because the person applying the later may not see the dependency? Well, you should have told me there was a dependancy :) As I'll end up taking both of these patches in the end, I'll queue your devm_kasprintf patch up in my staging-next tree so that it will work properly with your patch. thanks, greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: question regarding drivers/staging/iio/adc/ad7280a.c 2014-07-17 20:58 ` Greg Kroah-Hartman @ 2014-07-18 1:27 ` Greg Kroah-Hartman 0 siblings, 0 replies; 4+ messages in thread From: Greg Kroah-Hartman @ 2014-07-18 1:27 UTC (permalink / raw) To: Himangi Saraogi Cc: devel, Lars-Peter Clausen, linux-iio, linux-kernel, Julia Lawall, Jonathan Cameron On Thu, Jul 17, 2014 at 01:58:15PM -0700, Greg Kroah-Hartman wrote: > On Thu, Jul 17, 2014 at 11:40:04PM +0530, Himangi Saraogi wrote: > > Hi, > > > > I have sent in a patch for adding devm_kasprintf https://lkml.org/lkml/2014/7/ > > 16/667. > > I will be updating this file and send in a patch once it is accepted. Was it > > the right thing > > to do to send the devm_kasprintf patch separately from the patch on the file to > > use it for, > > because the person applying the later may not see the dependency? > > Well, you should have told me there was a dependancy :) > > As I'll end up taking both of these patches in the end, I'll queue your > devm_kasprintf patch up in my staging-next tree so that it will work > properly with your patch. Now applied there, so all should be good, right? thanks, greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-18 1:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAB78YHwneVuVBPujeKE=rEygvtyn=VvtLtd75+pvwqxPxYcB6g@mail.gmail.com>
2014-07-15 17:31 ` question regarding drivers/staging/iio/adc/ad7280a.c Jonathan Cameron
2014-07-16 11:14 ` Lars-Peter Clausen
[not found] ` <CAB78YHzEPZf-8m0zwFz5PZWkqMuX9m5W01f2JGQ+7MbAkTACPg@mail.gmail.com>
2014-07-17 20:58 ` Greg Kroah-Hartman
2014-07-18 1:27 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox