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: <20131119082704.GA1243@gmail.com>
Date:	Tue, 19 Nov 2013 09:27:04 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	akpm@...ux-foundation.org
Cc:	mingo@...e.hu, hpa@...or.com, tglx@...utronix.de,
	wujianguo@...wei.com, mingo@...hat.com, rientjes@...gle.com,
	linux-kernel@...r.kernel.org
Subject: Re: [patch 2/3] x86/srat: use NUMA_NO_NODE


* akpm@...ux-foundation.org <akpm@...ux-foundation.org> wrote:

> From: Jianguo Wu <wujianguo@...wei.com>
> Subject: x86/srat: use NUMA_NO_NODE
> 
> setup_node() return NUMA_NO_NODE or valid node id(>=0), So use more
> appropriate "if (node == NUMA_NO_NODE)" instead of "if (node < 0)"
> 
> Signed-off-by: Jianguo Wu <wujianguo@...wei.com>
> Acked-by: David Rientjes <rientjes@...gle.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
> 
>  arch/x86/mm/srat.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff -puN arch/x86/mm/srat.c~x86-srat-use-numa_no_node arch/x86/mm/srat.c
> --- a/arch/x86/mm/srat.c~x86-srat-use-numa_no_node
> +++ a/arch/x86/mm/srat.c
> @@ -76,7 +76,7 @@ acpi_numa_x2apic_affinity_init(struct ac
>  		return;
>  	}
>  	node = setup_node(pxm);
> -	if (node < 0) {
> +	if (node == NUMA_NO_NODE) {
>  		printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
>  		bad_srat();
>  		return;
> @@ -112,7 +112,7 @@ acpi_numa_processor_affinity_init(struct
>  	if (acpi_srat_revision >= 2)
>  		pxm |= *((unsigned int*)pa->proximity_domain_hi) << 8;
>  	node = setup_node(pxm);
> -	if (node < 0) {
> +	if (node == NUMA_NO_NODE) {
>  		printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
>  		bad_srat();
>  		return;
> @@ -166,7 +166,7 @@ acpi_numa_memory_affinity_init(struct ac
>  		pxm &= 0xff;
>  
>  	node = setup_node(pxm);
> -	if (node < 0) {
> +	if (node == NUMA_NO_NODE) {
>  		printk(KERN_ERR "SRAT: Too many proximity domains.\n");
>  		goto out_err_bad_srat;
>  	}

Dunno, I think the 'node < 0' pattern is more readable and is in 
general more robust than explicit NUMA_NO_NODE use - as it would 
handle other errors as well, not just -1.

Thanks,

	Ingo
--
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