public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Colin King <colin.king@canonical.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf evsel: fix NULL pointer deference when evsel->counts is NULL
Date: Wed, 23 Jan 2013 19:02:00 -0300	[thread overview]
Message-ID: <20130123220200.GE6687@ghostprotocols.net> (raw)
In-Reply-To: <871udfkua5.fsf@sejong.aot.lge.com>

Em Mon, Jan 21, 2013 at 01:53:21PM +0900, Namhyung Kim escreveu:
> On Sat, 19 Jan 2013 16:36:54 +0000, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>

> > __perf_evsel__read_on_cpu() only bails out with -ENOMEM if
> > evsel->counts is NULL and perf_evsel__alloc_counts() has returned
> > an error.  If perf_evsel__alloc_counts() does not return an error
> > we get an NULL pointer deference on evsel->counts->cpu[cpu]
> > if evsel->counts is NULL.

> perf_evsel__alloc_counts() should allocate evsel->counts when it sees
> evsel->counts is NULL and return negative error code if the allocation
> fails.

> So I don't see any problem in current code.  With your code, it won't
> try to allocate if ->counts is NULL but overwrite existing ->counts?

Right, the patch introduces a problem in code that works perfectly :-)

- Arnaldo

  reply	other threads:[~2013-01-23 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19 16:36 [PATCH] perf evsel: fix NULL pointer deference when evsel->counts is NULL Colin King
2013-01-21  4:53 ` Namhyung Kim
2013-01-23 22:02   ` Arnaldo Carvalho de Melo [this message]
2013-01-23 23:26     ` Colin Ian King

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=20130123220200.GE6687@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=colin.king@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /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