Skip to content

Commit

Permalink
Fix uninitialized local variable "covered" in i386 acpi-cpufreq driver
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
fyu1 authored and Linus Torvalds committed Jul 31, 2007
1 parent 7f8e00f commit 45c876b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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 */
Expand Down

0 comments on commit 45c876b

Please sign in to comment.