[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240403014326.970237-1-qq810974084@gmail.com>
Date: Wed, 3 Apr 2024 09:43:26 +0800
From: Huai-Yuan Liu <qq810974084@...il.com>
To: robert.moore@...el.com,
rafael.j.wysocki@...el.com,
lenb@...nel.org
Cc: linux-acpi@...r.kernel.org,
acpica-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org,
baijiaju1990@...look.com,
Huai-Yuan Liu <qq810974084@...il.com>
Subject: [PATCH] ACPICA: debugger: dbconvert: add a null pointer check
The memory allocation function ACPI_ALLOCATE_ZEROED does not guarantee a
successful allocation, but the subsequent code directly dereferences the
pointer that receives it, which may lead to null pointer dereference.
To fix this issue, a null pointer check should be added. If it is null,
return exception code AE_NO_MEMORY.
Fixes: 995751025572 ("ACPICA: Linuxize: Export debugger files to Linux")
Signed-off-by: Huai-Yuan Liu <qq810974084@...il.com>
---
drivers/acpi/acpica/dbconvert.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/acpi/acpica/dbconvert.c b/drivers/acpi/acpica/dbconvert.c
index 2b84ac093698..8dbab6932049 100644
--- a/drivers/acpi/acpica/dbconvert.c
+++ b/drivers/acpi/acpica/dbconvert.c
@@ -174,6 +174,8 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
elements =
ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
sizeof(union acpi_object));
+ if (!elements)
+ return (AE_NO_MEMORY);
this = string;
for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {
--
2.34.1
Powered by blists - more mailing lists