From: Fenghua Yu Date: Tue, 31 Jul 2007 07:37:26 +0000 (-0700) Subject: Fix uninitialized local variable "covered" in i386 acpi-cpufreq driver X-Git-Tag: v2.6.23-rc2~142 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=45c876bf12b431afa9c438b24bd6f55f3a815805;p=linux-2.6-omap-h63xx.git Fix uninitialized local variable "covered" in i386 acpi-cpufreq driver The local variable "covered" is used without initialization in i386 acpi-cpufreq driver. The initial value of covered should be 0. The bug will cause memory leak when hit. The following patch fixes this bug. Signed-off-by: Fenghua Yu Cc: Venkatesh Pallipadi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 6f846bee210..32d04b083e3 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -511,7 +511,6 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) static int acpi_cpufreq_early_init(void) { struct acpi_processor_performance *data; - cpumask_t covered; unsigned int i, j; dprintk("acpi_cpufreq_early_init\n"); @@ -520,14 +519,13 @@ static int acpi_cpufreq_early_init(void) data = kzalloc(sizeof(struct acpi_processor_performance), GFP_KERNEL); if (!data) { - for_each_cpu_mask(j, covered) { + for_each_possible_cpu(j) { kfree(acpi_perf_data[j]); acpi_perf_data[j] = NULL; } return -ENOMEM; } acpi_perf_data[i] = data; - cpu_set(i, covered); } /* Do initialization in ACPI core */