Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b094063 authored by Ilkka Koskinen's avatar Ilkka Koskinen Committed by Zhang Rui
Browse files

Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing



If either of the entries was missing, the driver tried to free memory
using uninitialized pointer. In addition, it was dereferencing null
pointer.

Signed-off-by: default avatarIlkka Koskinen <ilkka.koskinen@linux.intel.com>
Acked-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 97bf6af1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
	struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" };

	if (!acpi_has_method(handle, "_TRT"))
		return 0;
		return -ENODEV;

	status = acpi_evaluate_object(handle, "_TRT", NULL, &buffer);
	if (ACPI_FAILURE(status))
@@ -167,7 +167,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
		sizeof("RRNNNNNNNNNNN"), "RRNNNNNNNNNNN" };

	if (!acpi_has_method(handle, "_ART"))
		return 0;
		return -ENODEV;

	status = acpi_evaluate_object(handle, "_ART", NULL, &buffer);
	if (ACPI_FAILURE(status))
@@ -321,8 +321,8 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
	unsigned long length = 0;
	int count = 0;
	char __user *arg = (void __user *)__arg;
	struct trt *trts;
	struct art *arts;
	struct trt *trts = NULL;
	struct art *arts = NULL;

	switch (cmd) {
	case ACPI_THERMAL_GET_TRT_COUNT: