lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 29 Aug 2019 17:29:50 -0700
From:   Yizhuo <yzhai003@....edu>
To:     unlisted-recipients:; (no To-header on input)
Cc:     csong@...ucr.edu, zhiyunq@...ucr.edu, Yizhuo <yzhai003@....edu>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] kernel/smp: Variable nr_cpus is uninitialized if get_option() returns 0

Inside function nrcpus(), variable nr_cpus is uninitialized if
get_option() returns 0. However, the value will be used in the
if statement, which is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@....edu>
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index c94dd85c8d41..4bf24d4dc041 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -527,7 +527,7 @@ early_param("nosmp", nosmp);
 /* this is hard limit */
 static int __init nrcpus(char *str)
 {
-	int nr_cpus;
+	int nr_cpus = 0;
 
 	get_option(&str, &nr_cpus);
 	if (nr_cpus > 0 && nr_cpus < nr_cpu_ids)
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ