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: <20120611082249.GC31556@gmail.com>
Date:	Mon, 11 Jun 2012 10:22:49 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Alexander Gordeev <agordeev@...hat.com>
Cc:	Suresh Siddha <suresh.b.siddha@...el.com>,
	linux-kernel@...r.kernel.org, x86@...nel.org,
	Yinghai Lu <yinghai@...nel.org>
Subject: Re: [PATCH] x86/apic: Eliminate cpu_mask_to_apicid() operation


* Alexander Gordeev <agordeev@...hat.com> wrote:

> @@ -2151,7 +2134,12 @@ int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
>  			break;
>  	}
>  
> -	return __default_cpu_to_apicid(cpu, apicid);
> +	if (likely((unsigned int)cpu < nr_cpu_ids)) {
> +		*apicid = per_cpu(x86_cpu_to_apicid, cpu);
> +		return 0;
> +	} else {
> +		return -EINVAL;
> +	}

The type cast is rather ugly - why not change the cpu type to 
unsigned int?

Also, the else block is superfluous, just make it a return 
-EINVAL?

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