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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452438805-3205-1-git-send-email-AmeenAli023@gmail.com>
Date:	Sun, 10 Jan 2016 17:13:25 +0200
From:	Ameen <ameenali023@...il.com>
To:	mingo@...nel.org, peterz@...radead.org, mhocko@...e.com,
	vbabka@...e.cz
Cc:	linux-kernel@...r.kernel.org, Ameen <AmeenAli023@...il.com>
Subject: [PATCH 2/2] Use num_possible_cpus() instead of direct use of NR_CPUS.

WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus()..

Signed-off-by : Ameen Ali <Ameenali023@...il.com>
---
 kernel/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index d903c02..94033ac 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -549,13 +549,13 @@ static int __init maxcpus(char *str)
 early_param("maxcpus", maxcpus);
 
 /* Setup number of possible processor ids */
-int nr_cpu_ids __read_mostly = NR_CPUS;
+int nr_cpu_ids __read_mostly = num_possible_cpus();
 EXPORT_SYMBOL(nr_cpu_ids);
 
 /* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
 void __init setup_nr_cpu_ids(void)
 {
-	nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
+	nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),num_possible_cpus()) + 1;
 }
 
 void __weak smp_announce(void)
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ