acpi: method: skip over bad method_handle and failed message type
diff mbox series

Message ID 20190704161541.31154-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • acpi: method: skip over bad method_handle and failed message type
Related show

Commit Message

Colin King July 4, 2019, 4:15 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

When fetching the method_handle and the message type there are
issues warning about failures but no real error handling. This
can lead to an uninitialized method_handle being passed into
AcpiGetType that can cause an uninitialized pointer read. Fix
these failures by continuing on to the next method inthe list.

Addresses-Coverity: ("Uninitialized pointer read")
Fixes: e2a21f8d75d8 ("acpi: method: skip scope names in method_evaluate_method")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/method/method.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alex Hung July 4, 2019, 5:41 p.m. UTC | #1
On 2019-07-04 10:15 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> When fetching the method_handle and the message type there are
> issues warning about failures but no real error handling. This
> can lead to an uninitialized method_handle being passed into
> AcpiGetType that can cause an uninitialized pointer read. Fix
> these failures by continuing on to the next method inthe list.
> 
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: e2a21f8d75d8 ("acpi: method: skip scope names in method_evaluate_method")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/method/method.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index eeb9c7fa..787e3438 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -410,10 +410,12 @@ static int method_evaluate_method(fwts_framework *fw,
>  				status = AcpiGetHandle (NULL, method_name, &method_handle);
>  				if (ACPI_FAILURE(status)) {
>  					fwts_warning(fw, "Failed to get handle for object %s.", name);
> +					continue;
>  				}
>  				status = AcpiGetType(method_handle, &type);
>  				if (ACPI_FAILURE(status)) {
>  					fwts_warning(fw, "Failed to get object type for %s.",name);
> +					continue;
>  				}
>  
>  				if (type == ACPI_TYPE_LOCAL_SCOPE)
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu July 24, 2019, 6:30 a.m. UTC | #2
On 7/5/19 12:15 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> When fetching the method_handle and the message type there are
> issues warning about failures but no real error handling. This
> can lead to an uninitialized method_handle being passed into
> AcpiGetType that can cause an uninitialized pointer read. Fix
> these failures by continuing on to the next method inthe list.
> 
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: e2a21f8d75d8 ("acpi: method: skip scope names in method_evaluate_method")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/method/method.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index eeb9c7fa..787e3438 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -410,10 +410,12 @@ static int method_evaluate_method(fwts_framework *fw,
>   				status = AcpiGetHandle (NULL, method_name, &method_handle);
>   				if (ACPI_FAILURE(status)) {
>   					fwts_warning(fw, "Failed to get handle for object %s.", name);
> +					continue;
>   				}
>   				status = AcpiGetType(method_handle, &type);
>   				if (ACPI_FAILURE(status)) {
>   					fwts_warning(fw, "Failed to get object type for %s.",name);
> +					continue;
>   				}
>   
>   				if (type == ACPI_TYPE_LOCAL_SCOPE)
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Ivan Hu July 24, 2019, 6:31 a.m. UTC | #3
On 7/5/19 12:15 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> When fetching the method_handle and the message type there are
> issues warning about failures but no real error handling. This
> can lead to an uninitialized method_handle being passed into
> AcpiGetType that can cause an uninitialized pointer read. Fix
> these failures by continuing on to the next method inthe list.
> 
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: e2a21f8d75d8 ("acpi: method: skip scope names in method_evaluate_method")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/method/method.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index eeb9c7fa..787e3438 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -410,10 +410,12 @@ static int method_evaluate_method(fwts_framework *fw,
>   				status = AcpiGetHandle (NULL, method_name, &method_handle);
>   				if (ACPI_FAILURE(status)) {
>   					fwts_warning(fw, "Failed to get handle for object %s.", name);
> +					continue;
>   				}
>   				status = AcpiGetType(method_handle, &type);
>   				if (ACPI_FAILURE(status)) {
>   					fwts_warning(fw, "Failed to get object type for %s.",name);
> +					continue;
>   				}
>   
>   				if (type == ACPI_TYPE_LOCAL_SCOPE)
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index eeb9c7fa..787e3438 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -410,10 +410,12 @@  static int method_evaluate_method(fwts_framework *fw,
 				status = AcpiGetHandle (NULL, method_name, &method_handle);
 				if (ACPI_FAILURE(status)) {
 					fwts_warning(fw, "Failed to get handle for object %s.", name);
+					continue;
 				}
 				status = AcpiGetType(method_handle, &type);
 				if (ACPI_FAILURE(status)) {
 					fwts_warning(fw, "Failed to get object type for %s.",name);
+					continue;
 				}
 
 				if (type == ACPI_TYPE_LOCAL_SCOPE)