Skip to contentSkip to conversation

ACPI:dbconvert:check null return of ACPI_ALLOCATE_ZEROED in acpi_db_convert_to_package

PATCH New [email protected] 1 participant 1 message Jul 31, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI:dbconvert:check null return of ACPI_ALLOCATE_ZEROED in acpi_db_convert_to_package

From: Pei Xiao <[email protected]>

ACPI_ALLOCATE_ZEROED may fails, elements might be null and will cause null pointer dereference later.

---
 drivers/acpi/acpica/dbconvert.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/acpica/dbconvert.c +2 -0
index 2b84ac093698..a60d1098a105 100644
@@ -175,6 +175,8 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
 	    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++) {
 		this = acpi_db_get_next_token(this, &next, &type);
Signature · 5 lines
2.34.1


No virus found
		Checked by Hillstone Network AntiVirus