Message ID | 1418157243-6849-1-git-send-email-ilkka.koskinen@linux.intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Zhang Rui |
Headers | show |
On Tue, 2014-12-09 at 12:34 -0800, Ilkka Koskinen wrote: > 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> applied. thanks, rui > --- > drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 8 ++++---- > 1 file 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 e4e61b3..231cabc 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, > 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: -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c index e4e61b3..231cabc 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, 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: