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
WARNING: multiple messages have this Message-ID (diff)
From: Cong Ding <dinggnu@gmail.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [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
next prev parent reply other threads:[~2013-01-14 17:38 UTC|newest]
Thread overview: 10+ 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:18 ` Cong Ding
2013-01-14 17:23 ` Russell King - ARM Linux
2013-01-14 17:23 ` Russell King - ARM Linux
2013-01-14 17:38 ` Cong Ding [this message]
2013-01-14 17:38 ` Cong Ding
2013-01-14 17:40 ` Will Deacon
2013-01-14 17:40 ` Will Deacon
2013-01-14 17:40 ` [PATCH v2] arm: kernel/perf_event_cpu.c: remove unnecessary " Cong Ding
2013-01-14 17:40 ` 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.