aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlkka Koskinen <ilkka.koskinen@linux.intel.com>2014-12-09 15:34:03 -0500
committerZhang Rui <rui.zhang@intel.com>2014-12-21 08:27:25 -0500
commit7b09406390e76df97c9f5f29c23a4f56d982f22c (patch)
tree722e857992e1459ace48e01f2046a7f1c8685ce9
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
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: Ilkka Koskinen <ilkka.koskinen@linux.intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/thermal/int340x_thermal/acpi_thermal_rel.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
index e4e61b3fb11e..231cabc16e16 100644
--- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
+++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
@@ -82,7 +82,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
82 struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" }; 82 struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" };
83 83
84 if (!acpi_has_method(handle, "_TRT")) 84 if (!acpi_has_method(handle, "_TRT"))
85 return 0; 85 return -ENODEV;
86 86
87 status = acpi_evaluate_object(handle, "_TRT", NULL, &buffer); 87 status = acpi_evaluate_object(handle, "_TRT", NULL, &buffer);
88 if (ACPI_FAILURE(status)) 88 if (ACPI_FAILURE(status))
@@ -167,7 +167,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
167 sizeof("RRNNNNNNNNNNN"), "RRNNNNNNNNNNN" }; 167 sizeof("RRNNNNNNNNNNN"), "RRNNNNNNNNNNN" };
168 168
169 if (!acpi_has_method(handle, "_ART")) 169 if (!acpi_has_method(handle, "_ART"))
170 return 0; 170 return -ENODEV;
171 171
172 status = acpi_evaluate_object(handle, "_ART", NULL, &buffer); 172 status = acpi_evaluate_object(handle, "_ART", NULL, &buffer);
173 if (ACPI_FAILURE(status)) 173 if (ACPI_FAILURE(status))
@@ -321,8 +321,8 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
321 unsigned long length = 0; 321 unsigned long length = 0;
322 int count = 0; 322 int count = 0;
323 char __user *arg = (void __user *)__arg; 323 char __user *arg = (void __user *)__arg;
324 struct trt *trts; 324 struct trt *trts = NULL;
325 struct art *arts; 325 struct art *arts = NULL;
326 326
327 switch (cmd) { 327 switch (cmd) {
328 case ACPI_THERMAL_GET_TRT_COUNT: 328 case ACPI_THERMAL_GET_TRT_COUNT: