Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a2cb1ea authored by Zhengyuan Liu's avatar Zhengyuan Liu Committed by Greg Kroah-Hartman
Browse files

arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE



[ Upstream commit a194c5f2d2b3a05428805146afcabe5140b5d378 ]

The @node passed to cpumask_of_node() can be NUMA_NO_NODE, in that
case it will trigger the following WARN_ON(node >= nr_node_ids) due to
mismatched data types of @node and @nr_node_ids. Actually we should
return cpu_all_mask just like most other architectures do if passed
NUMA_NO_NODE.

Also add a similar check to the inline cpumask_of_node() in numa.h.

Signed-off-by: default avatarZhengyuan Liu <liuzhengyuan@tj.kylinos.cn>
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Link: https://lore.kernel.org/r/20200921023936.21846-1-liuzhengyuan@tj.kylinos.cn


Signed-off-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 37ad7b2c
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,9 @@ const struct cpumask *cpumask_of_node(int node);
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
static inline const struct cpumask *cpumask_of_node(int node)
static inline const struct cpumask *cpumask_of_node(int node)
{
{
	if (node == NUMA_NO_NODE)
		return cpu_all_mask;

	return node_to_cpumask_map[node];
	return node_to_cpumask_map[node];
}
}
#endif
#endif
+5 −1
Original line number Original line Diff line number Diff line
@@ -58,7 +58,11 @@ EXPORT_SYMBOL(node_to_cpumask_map);
 */
 */
const struct cpumask *cpumask_of_node(int node)
const struct cpumask *cpumask_of_node(int node)
{
{
	if (WARN_ON(node >= nr_node_ids))

	if (node == NUMA_NO_NODE)
		return cpu_all_mask;

	if (WARN_ON(node < 0 || node >= nr_node_ids))
		return cpu_none_mask;
		return cpu_none_mask;


	if (WARN_ON(node_to_cpumask_map[node] == NULL))
	if (WARN_ON(node_to_cpumask_map[node] == NULL))