[PATCH] fwts: fix acpi table access on failed load

Colin Ian King colin.king at canonical.com
Thu Apr 24 07:37:21 UTC 2014


On 24/04/14 08:35, Jeremy Kerr wrote:
> Currently, we may try and access tables even if the load has failed;
> after a failed load, acpi_tables_loaded will be
> ACPI_TABLES_LOADED_FAILED. The check in fwts_acpi_find_table is just:
> 
> 	if (acpi_tables_loaded == ACPI_TABLES_LOADED_FAILED)
> 		return FWTS_ERROR;
> 
> - which means we assume the tables have been loaded, so we begin to
> parse the tables array.
> 
> This change introduces a check if the load has failed.
> 
> Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
> 
> ---
>  src/lib/src/fwts_acpi_tables.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index f383aee..e40583e 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -959,6 +959,9 @@ int fwts_acpi_find_table(fwts_framework *fw, const char *name, const int which,
>  
>  	*info = NULL;
>  
> +	if (acpi_tables_loaded == ACPI_TABLES_LOADED_FAILED)
> +		return FWTS_ERROR;
> +
>  	if (acpi_tables_loaded == ACPI_TABLES_NOT_LOADED)
>  		if ((ret = fwts_acpi_load_tables(fw)) != FWTS_OK)
>  			return ret;
> 
Acked-by: Colin Ian King <colin.king at canonical.com>




More information about the fwts-devel mailing list