[lvc-project] [PATCH] sched/topology: Check return value of zalloc_cpumask_var()
Daniil Dulov
d.dulov at aladdin.ru
Thu Mar 7 16:23:40 MSK 2024
zalloc_cpumask_var() returns false if mask was not allocated.
So, let's check if cpu masks are allocated successfully.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 8d5dc5126bb2 ("sched/topology: Small cleanup")
Signed-off-by: Daniil Dulov <d.dulov at aladdin.ru>
---
kernel/sched/topology.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 10d1391e7416..2df98ffdfe16 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2600,9 +2600,10 @@ int __init sched_init_domains(const struct cpumask *cpu_map)
{
int err;
- zalloc_cpumask_var(&sched_domains_tmpmask, GFP_KERNEL);
- zalloc_cpumask_var(&sched_domains_tmpmask2, GFP_KERNEL);
- zalloc_cpumask_var(&fallback_doms, GFP_KERNEL);
+ if (!zalloc_cpumask_var(&sched_domains_tmpmask, GFP_KERNEL) ||
+ !zalloc_cpumask_var(&sched_domains_tmpmask2, GFP_KERNEL) ||
+ !zalloc_cpumask_var(&fallback_doms, GFP_KERNEL))
+ return -ENOMEM;
arch_update_cpu_topology();
asym_cpu_capacity_scan();
--
2.25.1
More information about the lvc-project
mailing list