ACK: [PATCH][V2] acpi: LPIT: check for monotonically increasing UID
ivanhu
ivan.hu at canonical.com
Tue Jan 23 09:15:04 UTC 2018
On 01/23/2018 10:19 AM, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
> src/acpi/lpit/lpit.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/src/acpi/lpit/lpit.c b/src/acpi/lpit/lpit.c
> index 73665b8..4ad7322 100644
> --- a/src/acpi/lpit/lpit.c
> +++ b/src/acpi/lpit/lpit.c
> @@ -143,6 +143,7 @@ static int lpit_test1(fwts_framework *fw)
> uint8_t *data;
> bool passed = true;
> uint32_t length;
> + uint16_t uid = 0, init_id = 0;
> fwts_acpi_table_lpit *lpit = (fwts_acpi_table_lpit *)table->data;
>
> if (table->length < sizeof(fwts_acpi_table_lpit)) {
> @@ -162,6 +163,7 @@ 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);
>
> @@ -181,6 +183,27 @@ static int lpit_test1(fwts_framework *fw)
> switch (*ptr) {
> case 0x0:
> lpit_check_type_0(fw, &length, &data, &passed);
> +
> + /* check lpi->id starts from zero */
> + if (init_id == 0 && lpi->id != 0) {
> + passed = false;
> + fwts_failed(fw, LOG_LEVEL_CRITICAL,
> + "LPITNativeCStateBadUID",
> + "Unique ID of Native C-state based LPI "
> + "structure must start from zero");
> + } else
> + init_id = 1;
> +
> + /* check lpi->id increases monotonically */
> + if (uid > lpi->id || (lpi->id - uid) > 1) {
> + 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;
Acked-by: Ivan Hu <ivan.hu at canonical.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180123/5027001a/attachment.html>
-------------- 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/20180123/5027001a/attachment.sig>
More information about the fwts-devel
mailing list