lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 21 Feb 2024 12:39:36 +0000
From: Colin Ian King <colin.i.king@...il.com>
To: "Rafael J . Wysocki" <rafael@...nel.org>,
	Zhang Rui <rui.zhang@...el.com>,
	Len Brown <lenb@...nel.org>,
	linux-acpi@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH][next] ACPI: thermal_lib: Add missing checks for errors in return code ret

Static analysis with clang scan build detected various return codes
being assigned and not checked. The calls to the trip point functions
probably should be error return checked as these can fail because
of unlikely issues such as invalid ACPI object names or ACPI value
evaluation failures.

Cleans up clang scan warnings, such as:
drivers/acpi/thermal_lib.c:106:9: warning: 2nd function call argument
is an uninitialized value [core.CallAndMessage]
        return thermal_temp(ret, temp_decik, ret_temp);


Fixes: 6908097aa5a7 ("ACPI: thermal_lib: Add functions returning temperature in deci-Kelvin")
Signed-off-by: Colin Ian King <colin.i.king@...il.com>
---

Note: Not tested.

---
 drivers/acpi/thermal_lib.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/acpi/thermal_lib.c b/drivers/acpi/thermal_lib.c
index 4e0519ca9739..4d27048ef075 100644
--- a/drivers/acpi/thermal_lib.c
+++ b/drivers/acpi/thermal_lib.c
@@ -103,6 +103,9 @@ int thermal_acpi_active_trip_temp(struct acpi_device *adev, int id, int *ret_tem
 	int temp_decik;
 	int ret = acpi_active_trip_temp(adev, id, &temp_decik);
 
+	if (ret)
+		return ret;
+
 	return thermal_temp(ret, temp_decik, ret_temp);
 }
 EXPORT_SYMBOL_GPL(thermal_acpi_active_trip_temp);
@@ -122,6 +125,9 @@ int thermal_acpi_passive_trip_temp(struct acpi_device *adev, int *ret_temp)
 	int temp_decik;
 	int ret = acpi_passive_trip_temp(adev, &temp_decik);
 
+	if (ret)
+		return ret;
+
 	return thermal_temp(ret, temp_decik, ret_temp);
 }
 EXPORT_SYMBOL_GPL(thermal_acpi_passive_trip_temp);
@@ -142,6 +148,9 @@ int thermal_acpi_hot_trip_temp(struct acpi_device *adev, int *ret_temp)
 	int temp_decik;
 	int ret = acpi_hot_trip_temp(adev, &temp_decik);
 
+	if (ret)
+		return ret;
+
 	return thermal_temp(ret, temp_decik, ret_temp);
 }
 EXPORT_SYMBOL_GPL(thermal_acpi_hot_trip_temp);
@@ -161,6 +170,9 @@ int thermal_acpi_critical_trip_temp(struct acpi_device *adev, int *ret_temp)
 	int temp_decik;
 	int ret = acpi_critical_trip_temp(adev, &temp_decik);
 
+	if (ret)
+		return ret;
+
 	return thermal_temp(ret, temp_decik, ret_temp);
 }
 EXPORT_SYMBOL_GPL(thermal_acpi_critical_trip_temp);
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ