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 <chenlei18@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2649556
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Lei Chen 2023-06-20 18:52:45 +08:00 • committed by Alexander Winkowski
commit 1be799e9f5
No known key found for this signature in database
GPG key ID: 72762A66704CDE44

View file

@ -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) {