[PATCH 2/5] perf, x86: Fix silly bug in data store buffer allocation

From: Peter Zijlstra
Date: Fri Mar 05 2010 - 10:43:25 EST


Fix up the ds allocation error path, where we could free @buffer
before we used it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
arch/x86/kernel/cpu/perf_event_intel_ds.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/cpu/perf_event_intel_ds.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ linux-2.6/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -127,10 +127,8 @@ static int reserve_ds_buffers(void)

err = -ENOMEM;
ds = kzalloc(sizeof(*ds), GFP_KERNEL);
- if (unlikely(!ds)) {
- kfree(buffer);
+ if (unlikely(!ds))
break;
- }
per_cpu(cpu_hw_events, cpu).ds = ds;

if (x86_pmu.bts) {

--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/