From ccce7f7c52f7374772626a9994fa6444cbc67bcd Mon Sep 17 00:00:00 2001 From: Avaneesh Kumar Dwivedi Date: Tue, 29 Nov 2022 02:52:46 +0530 Subject: [PATCH] cpu-topology: Change the size of allocation for cpu's raw_capacity Allocating raw_capacity nodes as per max possible cpus gives issues when there are cores in between which are not available. Allocate as many elements for holding raw_capacity as is last set bit position in possible mask. Change-Id: I90055f96c320b15960efac10d8d92c69413eeb6b Signed-off-by: Avaneesh Kumar Dwivedi --- drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 81169261a549..05c765c6d087 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -167,7 +167,7 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) &cpu_capacity); if (!ret) { if (!raw_capacity) { - raw_capacity = kcalloc(num_possible_cpus(), + raw_capacity = kcalloc(cpumask_last(cpu_possible_mask), sizeof(*raw_capacity), GFP_KERNEL); if (!raw_capacity) {