[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <9445401f-7cfb-bbb5-e25c-28f578efa212@valinux.co.jp>
Date: Wed, 26 Jul 2023 13:52:58 +0900
From: Kiwamu Okabe <okabe@...inux.co.jp>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ACPI: tables: Fix NULL dereference by acpi_os_map_memory()
The Infer static analyzer https://fbinfer.com/ reports following
NULL poinster dereference by the acpi_os_map_memory() function.
I believe this patch does fix the issue without any panic.
Signed-off-by: Kiwamu Okabe <okabe@...inux.co.jp>
---
drivers/acpi/tables.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 8ab0a82b4da4..ae7b7343bacf 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -717,6 +717,9 @@ acpi_table_initrd_override(struct acpi_table_header *existing_table,
while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
table = acpi_os_map_memory(acpi_tables_addr + table_offset,
ACPI_HEADER_SIZE);
+ if (WARN_ON(!table)) {
+ return AE_OK;
+ }
if (table_offset + table->length > all_tables_size) {
acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
WARN_ON(1);
@@ -772,6 +775,9 @@ static void __init acpi_table_initrd_scan(void)
while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
table = acpi_os_map_memory(acpi_tables_addr + table_offset,
ACPI_HEADER_SIZE);
+ if (WARN_ON(!table)) {
+ return;
+ }
if (table_offset + table->length > all_tables_size) {
acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
WARN_ON(1);
--
2.39.2
Powered by blists - more mailing lists