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]
Date:	Thu, 06 Mar 2014 15:38:35 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	amirv@...lanox.com
Cc:	netdev@...r.kernel.org, yevgenyp@...lanox.com,
	ogerlitz@...lanox.com, prarit@...hat.com, gvaradar@...co.com
Subject: Re: [PATCH net-next V3 1/2] net: Utility function to get
 affinity_hint by policy

From: Amir Vadai <amirv@...lanox.com>
Date: Thu,  6 Mar 2014 19:18:51 +0200

> +	rxq %= num_online_cpus();
> +
> +	p_numa_cores_mask = cpumask_of_node(numa_node);
> +	if (!p_numa_cores_mask)
> +		p_numa_cores_mask = cpu_online_mask;
> +
> +	for_each_cpu(affinity_cpu, p_numa_cores_mask) {
> +		if (--rxq < 0)
> +			goto out;
> +	}
> +
> +	if (!zalloc_cpumask_var(&non_numa_cores_mask, GFP_KERNEL)) {
> +		ret = -ENOMEM;
> +		goto err;
> +	}
> +
> +	cpumask_xor(non_numa_cores_mask, cpu_online_mask, p_numa_cores_mask);
> +
> +	for_each_cpu(affinity_cpu, non_numa_cores_mask) {
> +		if (--rxq < 0)
> +			goto out;
> +	}
> +
> +	ret = -EINVAL;
> +	goto err;

The NUMA core mask and the non-NUMA core mask must together provide
at least num_online_cpus() bits.

Said another way, since rxq is limited to num_online_cpus() it should
never exceed local + non-local cores.

Therefore this -EINVAL path seems like it should not be possible, and
therefore perhaps a WARN_ON() or similar would be appropriate.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ