Sfoglia il codice sorgente

CPU: Avoid using unititialized error variable in disable_nonboot_cpus()

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>
Rafael J. Wysocki 15 anni fa
parent
commit
e9a5f426b8
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      kernel/cpu.c

+ 1 - 1
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);