[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240412101402.14741-1-amishin@t-argos.ru>
Date: Fri, 12 Apr 2024 13:14:02 +0300
From: Aleksandr Mishin <amishin@...rgos.ru>
To: Lv Zheng <lv.zheng@...el.com>
CC: Aleksandr Mishin <amishin@...rgos.ru>, Robert Moore
<robert.moore@...el.com>, "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Len Brown <lenb@...nel.org>, <linux-acpi@...r.kernel.org>,
<acpica-devel@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<lvc-project@...uxtesting.org>
Subject: [PATCH] ACPICA: Handle memory allocation failure
In acpi_db_convert_to_package() ACPI_ALLOCATE_ZEROED() may return NULL
in case of memory allocation error. This will lead to NULL pointer
dereference.
Fix this bug by adding NULL return check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 995751025572 ("ACPICA: Linuxize: Export debugger files to Linux")
Signed-off-by: Aleksandr Mishin <amishin@...rgos.ru>
---
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.30.2
Powered by blists - more mailing lists