public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corey Ashford <cjashfor@linux.vnet.ibm.com>
To: jovi zhang <bookjovi@gmail.com>
Cc: Thiago Farina <tfransosi@gmail.com>,
	a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu,
	acme@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf_event: fix error handling path
Date: Thu, 09 Dec 2010 09:06:37 -0800	[thread overview]
Message-ID: <4D010C9D.6020005@linux.vnet.ibm.com> (raw)
In-Reply-To: <AANLkTi=HGdGs++FKY6=icEs3FTwSggXTu42JQ+1MCxBc@mail.gmail.com>

On 12/07/2010 05:51 PM, jovi zhang wrote:
> On Mon, Dec 6, 2010 at 9:59 AM, jovi zhang<bookjovi@gmail.com>  wrote:
>> On Sun, Dec 5, 2010 at 8:29 PM, Thiago Farina<tfransosi@gmail.com>  wrote:
>>>
>>> On Sat, Dec 4, 2010 at 1:19 AM,<bookjovi@gmail.com>  wrote:
>>>> fix error handling path
>>>>
>>>> Signed-off-by: Jovi Zhang<bookjovi@gmail.com>
>>>>   kernel/perf_event.c |    2 --
>>>>   1 files changed, 0 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
>>>> index cb6c0d2..62f9e9d 100644
>>>> --- a/kernel/perf_event.c
>>>> +++ b/kernel/perf_event.c
>>>> @@ -1918,8 +1918,6 @@ static int get_callchain_buffers(void)
>>>>         }
>>>>
>>>>         err = alloc_callchain_buffers();
>>>> -       if (err)
>>>> -               release_callchain_buffers();
>>>
>>> Care to explain in the change log message? As I reader, is not clear
>>> to me what is wrong with this.
>>
>> Sorry, the description should be as:
>> fix error handling path. alloc_callchain_buffers() can return -ENOMEM,
>> in this time callchain_cpus_entries maybe is NULL, It will oops if
>> invoke release_callchain_buffers() when callchain_cpus_entries is
>> NULL.
>>
> I hope my understanding is right, is it?

One possible problem here is what if it returns an error other than 
-ENOMEM, and the buffers do need to be released?  Maybe you could change 
the code to

err = alloc_callchain_buffers();
if (err != -ENOMEM)
	release_callchain_buffers();


Currently, alloc_callchain_buffers cannot return any error code other 
than -ENOMEM, but that might change in the future.

- Corey

  reply	other threads:[~2010-12-09 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-04  3:19 [PATCH] perf_event: fix error handling path bookjovi
2010-12-05 12:29 ` Thiago Farina
2010-12-06  1:59   ` jovi zhang
2010-12-08  1:51     ` jovi zhang
2010-12-09 17:06       ` Corey Ashford [this message]
2010-12-09 17:17         ` Peter Zijlstra
2010-12-10  2:27           ` jovi zhang

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=4D010C9D.6020005@linux.vnet.ibm.com \
    --to=cjashfor@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=bookjovi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=tfransosi@gmail.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