[PATCH] fix oprofile vfree warning on error

From: Anton Blanchard
Date: Sat Sep 04 2004 - 13:03:09 EST



On error we can call __free_cpu_buffers with only some buffers
allocated. I was getting a bunch of vfree warnings when I hit it, we
should check before calling vfree.

Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>

diff -puN drivers/oprofile/cpu_buffer.c~oprofile_vfree_fix drivers/oprofile/cpu_buffer.c
--- linux-2.5/drivers/oprofile/cpu_buffer.c~oprofile_vfree_fix 2004-09-05 02:37:38.223212931 +1000
+++ linux-2.5-anton/drivers/oprofile/cpu_buffer.c 2004-09-05 02:37:43.608142109 +1000
@@ -36,8 +36,10 @@ static void __free_cpu_buffers(int num)
{
int i;

- for_each_online_cpu(i)
- vfree(cpu_buffer[i].buffer);
+ for_each_online_cpu(i) {
+ if (cpu_buffer[i].buffer)
+ vfree(cpu_buffer[i].buffer);
+ }
}



_
-
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/