[PATCH] LoongArch: Fix acpi_package_ids array overflow

Bibo Mao <[email protected]>
Newsgroups dev.linux.lists.loongarch,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
With LoongArch virt machine, one typical setting is one core per socket,
there will max 256 sockets on one VM. With PPTT acpi table, array
acpi_package_ids will be overflowed.

Here change array size of acpi_package_ids with max value of
MAX_PACKAGES and KVM_MAX_VCPUS.

Fixes: 4e8f58620f67 ("LoongArch: Retrieve CPU package ID from PPTT when available")
Cc: [email protected]
Signed-off-by: Bibo Mao <[email protected]>
---
 arch/loongarch/kernel/acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index 873e90990771..cb454ee92b20 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -13,6 +13,7 @@
 #include <linux/export.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
+#include <linux/kvm_host.h>
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
 #include <linux/serial_core.h>
@@ -202,7 +203,7 @@ static void __init acpi_process_madt(void)
 
 int pptt_enabled;
 static int acpi_nr_packages;
-static int acpi_package_ids[MAX_PACKAGES];
+static int acpi_package_ids[MAX(MAX_PACKAGES, KVM_MAX_VCPUS)];
 
 int __init parse_acpi_topology(void)
 {

base-commit: 075b74841bd0065a3bda3440873c747938e69b68
-- 
2.39.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.