[PATCH] acpi: LPIT: check for monotonically increasing UID

ivanhu ivan.hu at canonical.com
Tue Dec 19 03:07:03 UTC 2017



On 11/21/2017 11:21 AM, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/acpi/lpit/lpit.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/acpi/lpit/lpit.c b/src/acpi/lpit/lpit.c
> index eb4e3af..de7073c 100644
> --- a/src/acpi/lpit/lpit.c
> +++ b/src/acpi/lpit/lpit.c
> @@ -162,8 +162,10 @@ static int lpit_test1(fwts_framework *fw)
>  
>  	/* Got enough data to be able to inspect the initial 2 x 32 bit words.. */
>  	while (length > 8) {
> +		fwts_acpi_table_lpit_c_state *lpi = (fwts_acpi_table_lpit_c_state *)data;
>  		uint32_t *ptr = (uint32_t *)data;
>  		uint32_t lpi_length = *(ptr + 1);
> +		uint16_t uid = 0;
>  
>  		/* Stated LPI length must not be longer than what's left in the table */
>  		if (length < lpi_length) {
> @@ -181,6 +183,16 @@ static int lpit_test1(fwts_framework *fw)
>  		switch (*ptr) {
>  		case 0x0:
>  			lpit_check_type_0(fw, &length, &data, &passed);
> +
> +			if (uid > lpi->id && (lpi->id - uid) > 1) {
not quiet sure what this does, what if uid = 0 but firmware set lpi->id
= 1 first, it should be false?

Ivan
> +				passed = false;
> +				fwts_failed(fw, LOG_LEVEL_CRITICAL,
> +					"LPITNativeCStateBadUID",
> +					"Unique ID of Native C-state based LPI  "
> +					"structure must be a zero-based monotonically "
> +					"increasing value");
> +			}
> +			uid = lpi->id;
>  			break;
>  		default:
>  			passed = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20171219/edf615a9/attachment.sig>


More information about the fwts-devel mailing list