ACK: [PATCH] acpi: s3,s4: ensure status is initialized

Alex Hung alex.hung at canonical.com
Thu Mar 25 00:13:44 UTC 2021


On 2021-03-24 11:12 a.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> The call to fwts_exec can potentially not set status if an exec
> pipe open fails. Don't assume that status will be updated and
> instead initialize status to zero.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/s3/s3.c | 2 +-
>  src/acpi/s4/s4.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 4a14ed5b..9cc94a17 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -187,7 +187,7 @@ static int wrap_pmutils_do_suspend(fwts_pm_method_vars *fwts_settings,
>  	int *duration,
>  	const char *command)
>  {
> -	int status;
> +	int status = 0;
>  
>  	(void)fwts_klog_write(fwts_settings->fw, FWTS_SUSPEND "\n");
>  	fwts_progress_message(fwts_settings->fw, percent, "(Suspending)");
> diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c
> index 7b2c3b8c..b622b05a 100644
> --- a/src/acpi/s4/s4.c
> +++ b/src/acpi/s4/s4.c
> @@ -148,7 +148,7 @@ static int wrap_pmutils_do_s4(fwts_pm_method_vars *fwts_settings,
>  	int *duration,
>  	const char *command)
>  {
> -	int status;
> +	int status = 0;
>  
>  	fwts_progress_message(fwts_settings->fw, percent, "(Hibernating)");
>  	time(&(fwts_settings->t_start));
> 


Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list