Skip to contentSkip to conversation

drivers/acpi/x86: check return null pointer from acpi_evaluate_dsm()

PATCH In review Li Zhong 2 participants 2 messages Aug 28, 2022 – Aug 29, 2022 ACPI

lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 drivers/acpi/x86: check return null pointer from acpi_evaluate_dsm()

From: lily <[email protected]>

Check return value from acpi_evaluate_dsm(). Only do ACPI_FREE() when out_obj is not NULL pointers.

---
 drivers/acpi/x86/s2idle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/x86/s2idle.c +2 -1
index f9ac12b778e6..1b449d3cfbf7 100644
@@ -328,7 +328,8 @@ static void acpi_sleep_run_lps0_dsm(unsigned int func, unsigned int func_mask, g
 
 	out_obj = acpi_evaluate_dsm(lps0_device_handle, &dsm_guid,
 					rev_id, func, NULL);
-	ACPI_FREE(out_obj);
+	if (!out_obj)
+		ACPI_FREE(out_obj);
 
 	acpi_handle_debug(lps0_device_handle, "_DSM function %u evaluation %s\n",
 			  func, out_obj ? "successful" : "failed");
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 4 lines · Li Zhong

From: lily <[email protected]>

Check return value from acpi_evaluate_dsm(). Only do ACPI_FREE() when out_obj is not NULL pointers.

ACPI_FREE() expands to kfree() and that allows NULL pointers so I don't think this patch is necessary.