Skip to contentSkip to conversation

CPU: Avoid using unititialized error variable in disable_nonboot_cpus()

PATCH New Rafael J. Wysocki 1 participant 1 message May 27, 2010 CPU hotplug

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CPU: Avoid using unititialized error variable in disable_nonboot_cpus()

From: Rafael J. Wysocki <[email protected]>

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.

---
 kernel/cpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cpu.c +1 -1
Index: linux-2.6/kernel/cpu.c
===================================================================
@@ -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);