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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190903075352.GY2369@hirez.programming.kicks-ass.net>
Date:   Tue, 3 Sep 2019 09:53:52 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     Yunsheng Lin <linyunsheng@...wei.com>, dalias@...c.org,
        linux-sh@...r.kernel.org, catalin.marinas@....com,
        dave.hansen@...ux.intel.com, heiko.carstens@...ibm.com,
        linuxarm@...wei.com, jiaxun.yang@...goat.com,
        linux-mips@...r.kernel.org, mwb@...ux.vnet.ibm.com,
        paulus@...ba.org, hpa@...or.com, sparclinux@...r.kernel.org,
        chenhc@...ote.com, will@...nel.org, cai@....pw,
        linux-s390@...r.kernel.org, ysato@...rs.sourceforge.jp,
        mpe@...erman.id.au, x86@...nel.org, rppt@...ux.ibm.com,
        borntraeger@...ibm.com, dledford@...hat.com, mingo@...hat.com,
        jeffrey.t.kirsher@...el.com, benh@...nel.crashing.org,
        jhogan@...nel.org, nfont@...ux.vnet.ibm.com, mattst88@...il.com,
        len.brown@...el.com, gor@...ux.ibm.com, anshuman.khandual@....com,
        bp@...en8.de, luto@...nel.org, tglx@...utronix.de,
        naveen.n.rao@...ux.vnet.ibm.com,
        linux-arm-kernel@...ts.infradead.org, rth@...ddle.net,
        axboe@...nel.dk, linuxppc-dev@...ts.ozlabs.org,
        linux-kernel@...r.kernel.org, ralf@...ux-mips.org,
        tbogendoerfer@...e.de, paul.burton@...s.com,
        linux-alpha@...r.kernel.org, ink@...assic.park.msu.ru,
        akpm@...ux-foundation.org, robin.murphy@....com,
        davem@...emloft.net
Subject: [PATCH] x86/mm: Fix cpumask_of_node() error condition

On Mon, Sep 02, 2019 at 08:17:31PM +0200, Ingo Molnar wrote:

> Nitpicking: please also fix the kernel message to say ">=".

Full patch below.

---
Subject: x86/mm: Fix cpumask_of_node() error condition

When CONFIG_DEBUG_PER_CPU_MAPS we validate that the @node argument of
cpumask_of_node() is a valid node_id. It however forgets to check for
negative numbers. Fix this by explicitly casting to unsigned.

  (unsigned)node >= nr_node_ids

verifies: 0 <= node < nr_node_ids

Also ammend the error message to match the condition.

Acked-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
 arch/x86/mm/numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index e6dad600614c..4123100e0eaf 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -861,9 +861,9 @@ void numa_remove_cpu(int cpu)
  */
 const struct cpumask *cpumask_of_node(int node)
 {
-	if (node >= nr_node_ids) {
+	if ((unsigned)node >= nr_node_ids) {
 		printk(KERN_WARNING
-			"cpumask_of_node(%d): node > nr_node_ids(%u)\n",
+			"cpumask_of_node(%d): (unsigned)node >= nr_node_ids(%u)\n",
 			node, nr_node_ids);
 		dump_stack();
 		return cpu_none_mask;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ