From 1be799e9f54de5a5d8abcaf015d2c1cddf2cc907 Mon Sep 17 00:00:00 2001 From: Lei Chen Date: Tue, 20 Jun 2023 18:52:45 +0800 Subject: [PATCH] topolygy:fix kansan panic at topology_parse_cpu_capacity BUG: KASAN: slab-out-of-bounds in topology_parse_cpu_capacity Write of size 4 at addr ffffffa64515031c by task swapper/0/1 Revert the changes I90055f96c320b15960efac10d8d92c69413eeb6b Fix the kasan panic. Change-Id: I7a8701e29a9de82c175e3c4e265a9bf179e32f91 Signed-off-by: Lei Chen Reviewed-on: https://gerrit.mot.com/2649556 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- 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 6a5ba34ad958..54d08abbd43d 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(cpumask_last(cpu_possible_mask), + raw_capacity = kcalloc(num_possible_cpus(), sizeof(*raw_capacity), GFP_KERNEL); if (!raw_capacity) {