[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230410093601.3945712-1-void0red@hust.edu.cn>
Date: Mon, 10 Apr 2023 17:36:01 +0800
From: Kang Chen <void0red@...t.edu.cn>
To: rafael@...nel.org
Cc: acpica-devel@...ts.linuxfoundation.org, lenb@...nel.org,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
rafael.j.wysocki@...el.com, robert.moore@...el.com,
void0red@...il.com
Subject: [PATCH v2] ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
From: Kang Chen <void0red@...il.com>
ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will
cause null pointer dereference later.
Link: https://github.com/acpica/acpica/commit/84b3752cfa0ce4b0ebecae5e193c937b8ed6e278
Signed-off-by: Kang Chen <void0red@...il.com>
---
v2 -> v1: add a github link
drivers/acpi/acpica/dbnames.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c
index 3615e1a6e..b91155ea9 100644
--- a/drivers/acpi/acpica/dbnames.c
+++ b/drivers/acpi/acpica/dbnames.c
@@ -652,6 +652,9 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
object_info =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_object_info));
+ if (!object_info)
+ return (AE_NO_MEMORY);
+
/* Walk the namespace from the root */
(void)acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
--
2.34.1
Powered by blists - more mailing lists