linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dinggnu@gmail.com (Cong Ding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: kernel/perf_event_cpu.c: fix error null pointer dereference check
Date: Mon, 14 Jan 2013 17:38:26 +0000	[thread overview]
Message-ID: <20130114173826.GA917@gmail.com> (raw)
In-Reply-To: <20130114172346.GK23505@n2100.arm.linux.org.uk>

On Mon, Jan 14, 2013 at 05:23:46PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 14, 2013 at 05:18:53PM +0000, Cong Ding wrote:
> > the pointer cpu_pmu is used without null pointer dereference check, and is
> > checked after the using of it, so we move the null pointer check to before the
> > first use.
> 
> The NULL pointer check is not necessary.  cpu_pmu_init() is called
> after cpu_pmu has already been dereferenced by its caller:
> 
>         cpu_pmu = pmu;
>         cpu_pmu->plat_device = pdev;
>         cpu_pmu_init(cpu_pmu);
> 
> So...
> 
> > -	/* Ensure the PMU has sane values out of reset. */
> > -	if (cpu_pmu && cpu_pmu->reset)
> 
> Just replace this with:
> 	if (cpu_pmu->reset)
Thanks Russell, I will send version 2.

- cong

  reply	other threads:[~2013-01-14 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 17:18 [PATCH] arm: kernel/perf_event_cpu.c: fix error null pointer dereference check Cong Ding
2013-01-14 17:23 ` Russell King - ARM Linux
2013-01-14 17:38   ` Cong Ding [this message]
2013-01-14 17:40     ` Will Deacon
2013-01-14 17:40 ` [PATCH v2] arm: kernel/perf_event_cpu.c: remove unnecessary " Cong Ding

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=20130114173826.GA917@gmail.com \
    --to=dinggnu@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).