Skip to content

Commit

Permalink
CPU: Avoid using unititialized error variable in disable_nonboot_cpus()
Browse files Browse the repository at this point in the history
If there's only one CPU online when disable_nonboot_cpus() is called,
the error variable will not be initialized and that may lead to
erroneous behavior.  Fix this issue by initializing error in
disable_nonboot_cpus() as appropriate.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed May 30, 2010
1 parent 97ef6f7 commit e9a5f42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static cpumask_var_t frozen_cpus;

int disable_nonboot_cpus(void)
{
int cpu, first_cpu, error;
int cpu, first_cpu, error = 0;

cpu_maps_update_begin();
first_cpu = cpumask_first(cpu_online_mask);
Expand Down

0 comments on commit e9a5f42

Please sign in to comment.