Commit 45c876bf authored by Fenghua Yu's avatar Fenghua Yu Committed by Linus Torvalds

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: default avatarFenghua Yu <fenghua.yu@intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7f8e00f2
...@@ -511,7 +511,6 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) ...@@ -511,7 +511,6 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
static int acpi_cpufreq_early_init(void) static int acpi_cpufreq_early_init(void)
{ {
struct acpi_processor_performance *data; struct acpi_processor_performance *data;
cpumask_t covered;
unsigned int i, j; unsigned int i, j;
dprintk("acpi_cpufreq_early_init\n"); dprintk("acpi_cpufreq_early_init\n");
...@@ -520,14 +519,13 @@ static int acpi_cpufreq_early_init(void) ...@@ -520,14 +519,13 @@ static int acpi_cpufreq_early_init(void)
data = kzalloc(sizeof(struct acpi_processor_performance), data = kzalloc(sizeof(struct acpi_processor_performance),
GFP_KERNEL); GFP_KERNEL);
if (!data) { if (!data) {
for_each_cpu_mask(j, covered) { for_each_possible_cpu(j) {
kfree(acpi_perf_data[j]); kfree(acpi_perf_data[j]);
acpi_perf_data[j] = NULL; acpi_perf_data[j] = NULL;
} }
return -ENOMEM; return -ENOMEM;
} }
acpi_perf_data[i] = data; acpi_perf_data[i] = data;
cpu_set(i, covered);
} }
/* Do initialization in ACPI core */ /* Do initialization in ACPI core */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment