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]
Message-Id: <1281864933-6145-1-git-send-email-namhyung@gmail.com>
Date:	Sun, 15 Aug 2010 18:35:33 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] init/main.c: refactor maxcpus()

get_option() requires 2nd arg to be a pointer to int but setup_max_cpus is a
pointer to unsigned int. Use max_cpus instead and update setup_max_cpus only
if given value is in the proper range.

Signed-off-by: Namhyung Kim <namhyung@...il.com>
---
 init/main.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/init/main.c b/init/main.c
index 86cbfd0..b06b8f2 100644
--- a/init/main.c
+++ b/init/main.c
@@ -165,9 +165,13 @@ early_param("nr_cpus", nrcpus);
 
 static int __init maxcpus(char *str)
 {
-	get_option(&str, &setup_max_cpus);
-	if (setup_max_cpus == 0)
-		arch_disable_smp_support();
+	int max_cpus;
+
+	get_option(&str, &max_cpus);
+	if (max_cpus == 0)
+		nosmp(NULL);
+	else if (0 < max_cpus && max_cpus < NR_CPUS)
+		setup_max_cpus = max_cpus;
 
 	return 0;
 }
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ