[PATCH] powerpc/perfctr: Check oprofile_cpu_type for NULL before using it

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Aug 6 16:48:19 EST 2009


On Thu, 2009-08-06 at 07:41 +0100, David Woodhouse wrote:
> On Thu, 2009-08-06 at 14:02 +1000, Benjamin Herrenschmidt wrote:
> > If the current CPU doesn't support performance counters,
> > cur_cpu_spec->oprofile_cpu_type can be NULL. The current
> > perfctr modules don't test for that case and would thus
> > crash.
> 
> It can't actually be NULL on a 64-bit CPU; all 64-bit CPUs in the table
> have ->oprofile_cpu_type set.

 .... today :-)

> Of course, adding the check probably makes sense anyway.

Yup, better safe.

Cheers,
Ben.




More information about the Linuxppc-dev mailing list