Subject: perfmon2: clear partial sample entry in occurence From: Kevin Corry When recording a partial sample, we only have access to the valid data in count mode. If we're sampling in occurrence or threshold mode, we need to clear the appropriate entry in the buffer, or there could be garbage data sent to user-space. Signed-off-by: Kevin Corry Signed-off-by: Carl Love Signed-off-by: Arnd Bergmann Index: linux-2.6/arch/powerpc/perfmon/perfmon_cell_hw_smpl.c =================================================================== --- linux-2.6.orig/arch/powerpc/perfmon/perfmon_cell_hw_smpl.c +++ linux-2.6/arch/powerpc/perfmon/perfmon_cell_hw_smpl.c @@ -187,14 +187,16 @@ static void read_partial_sample(struct p u64 **trace_buffer_sample) { u32 pm_control = set->pmcs[CELL_PMC_PM_CONTROL]; - u32 *partial_sample; + u32 *partial_sample = (u32 *)*trace_buffer_sample; int i, cpu = smp_processor_id(); if (CBE_PM_TRACE_MODE_GET(pm_control) == CBE_PM_TRACE_MODE_COUNT) { - partial_sample = (u32 *)*trace_buffer_sample; for (i = 0; i < NR_PHYS_CTRS; i++) { partial_sample[i] = cbe_read_phys_ctr(cpu, i); } + } else { + memset(partial_sample, 0, + NR_PHYS_CTRS * sizeof(*partial_sample)); } ent_hdr->pm_interval = cbe_read_pm(cpu, pm_interval);