CPU: Avoid using unititialized error variable in disable_nonboot_cpus()
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 27 May 2010 20:16:22 +0000 (22:16 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 30 May 2010 16:06:00 +0000 (09:06 -0700)
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>
kernel/cpu.c

index 3097382eb44a64c631df8b497c0392fc756bbf87..8b92539b4754274528fdc380d45baf6d481001b1 100644 (file)
@@ -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);