public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: Davidlohr Bueso <dave@gnu.org>,
	cpufreq@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH] cpufreq: unnecesary double free in pcc_cpufreq_do_osc
Date: Thu, 30 Sep 2010 16:08:51 -0400	[thread overview]
Message-ID: <20100930200850.GB4120@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1009301258550.9112@chino.kir.corp.google.com>

On Thu, Sep 30, 2010 at 01:02:54PM -0700, David Rientjes wrote:
  > > index 994230d..db7dc35 100644
 > > --- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
 > > +++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
 > > @@ -379,6 +379,8 @@ static int __init pcc_cpufreq_do_osc(acpi_handle *handle)
 > >  	if (!(supported & 0x1))
 > >  		return -ENODEV;
 > >  
 > > +	return ret;
 > > +
 > >  out_free:
 > >  	kfree(output.pointer);
 > >  	return ret;
 > 
 > Why is the kfree() unnecessary?  acpi_evaluate_object() will allocate a 
 > new output.pointer if it returns 0, so at this point in the code you would 
 > now be leaking the buffer.
 > 
 > Instead, it would probably be better to fix the existing memory leaks in 
 > that function where we return -ENODEV without going to out_free when 
 > output.length is non-zero.

Oh, *duh*. That was subtle.
You, and Pekka are of course correct.  I'll merge up Pekka's patch.

thanks,

	Dave


  reply	other threads:[~2010-09-30 20:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 19:43 [RESEND PATCH] cpufreq: unnecesary double free in pcc_cpufreq_do_osc Davidlohr Bueso
2010-09-30 19:59 ` Pekka Enberg
2010-09-30 20:06   ` Dave Jones
2010-10-01  4:47     ` Pekka Enberg
2010-10-01  5:25       ` Dave Jones
2010-09-30 20:06   ` David Rientjes
2010-09-30 20:02 ` David Rientjes
2010-09-30 20:08   ` Dave Jones [this message]
2010-09-30 20:17     ` Davidlohr Bueso
2010-09-30 20:15   ` Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100930200850.GB4120@redhat.com \
    --to=davej@redhat.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=dave@gnu.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox