lkml.org 
[lkml]   [2013]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm: kernel/perf_event_cpu.c: fix error null pointer dereference check
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)


\
 
 \ /
  Last update: 2013-01-14 19:01    [W:0.057 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site