diff mbox

[4/4] acpi: rsdp: revision 1 must have length 20 according to ACPI 6.1 errata

Message ID 1497588113-8954-4-git-send-email-alex.hung@canonical.com
State Accepted
Headers show

Commit Message

Alex Hung June 16, 2017, 4:41 a.m. UTC
Spec update (mantis 1664) clearly points out length of revision 1 is 20,
and no fields are beyond offset 19

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/rsdp/rsdp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Colin Ian King June 16, 2017, 7:52 a.m. UTC | #1
On 16/06/17 05:41, Alex Hung wrote:
> Spec update (mantis 1664) clearly points out length of revision 1 is 20,
> and no fields are beyond offset 19
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/rsdp/rsdp.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/acpi/rsdp/rsdp.c b/src/acpi/rsdp/rsdp.c
> index a084d9c..becdbb2 100644
> --- a/src/acpi/rsdp/rsdp.c
> +++ b/src/acpi/rsdp/rsdp.c
> @@ -102,6 +102,19 @@ static int rsdp_test1(fwts_framework *fw)
>  			"firmware ACPI complaint.");
>  	}
>  
> +	/* ACPI 6.1 errata clarifies revision 1 must have length 20 */
> +	if (rsdp->revision == 1) {
> +		if (rsdp->length == 20)
> +			fwts_passed(fw, "RSDP: the table is the correct length.");
> +		else
> +			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> +				"RSDPBadLength",
> +				"RSDP: length of Revision 1 is %d bytes but should be 20.",
> +				rsdp->length);
> +
> +		return FWTS_OK;
> +	}
> +
>  	if (rsdp->revision <= 2)
>  		fwts_passed(fw,
>  			    "RSDP: revision is %" PRIu8 ".", rsdp->revision);
> 
Good extra level of checking.

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu June 22, 2017, 7:13 a.m. UTC | #2
On 06/16/2017 12:41 PM, Alex Hung wrote:
> Spec update (mantis 1664) clearly points out length of revision 1 is 20,
> and no fields are beyond offset 19
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>   src/acpi/rsdp/rsdp.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/src/acpi/rsdp/rsdp.c b/src/acpi/rsdp/rsdp.c
> index a084d9c..becdbb2 100644
> --- a/src/acpi/rsdp/rsdp.c
> +++ b/src/acpi/rsdp/rsdp.c
> @@ -102,6 +102,19 @@ static int rsdp_test1(fwts_framework *fw)
>   			"firmware ACPI complaint.");
>   	}
>   
> +	/* ACPI 6.1 errata clarifies revision 1 must have length 20 */
> +	if (rsdp->revision == 1) {
> +		if (rsdp->length == 20)
> +			fwts_passed(fw, "RSDP: the table is the correct length.");
> +		else
> +			fwts_failed(fw, LOG_LEVEL_MEDIUM,
> +				"RSDPBadLength",
> +				"RSDP: length of Revision 1 is %d bytes but should be 20.",
> +				rsdp->length);
> +
> +		return FWTS_OK;
> +	}
> +
>   	if (rsdp->revision <= 2)
>   		fwts_passed(fw,
>   			    "RSDP: revision is %" PRIu8 ".", rsdp->revision);
> 

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

Patch

diff --git a/src/acpi/rsdp/rsdp.c b/src/acpi/rsdp/rsdp.c
index a084d9c..becdbb2 100644
--- a/src/acpi/rsdp/rsdp.c
+++ b/src/acpi/rsdp/rsdp.c
@@ -102,6 +102,19 @@  static int rsdp_test1(fwts_framework *fw)
 			"firmware ACPI complaint.");
 	}
 
+	/* ACPI 6.1 errata clarifies revision 1 must have length 20 */
+	if (rsdp->revision == 1) {
+		if (rsdp->length == 20)
+			fwts_passed(fw, "RSDP: the table is the correct length.");
+		else
+			fwts_failed(fw, LOG_LEVEL_MEDIUM,
+				"RSDPBadLength",
+				"RSDP: length of Revision 1 is %d bytes but should be 20.",
+				rsdp->length);
+
+		return FWTS_OK;
+	}
+
 	if (rsdp->revision <= 2)
 		fwts_passed(fw,
 			    "RSDP: revision is %" PRIu8 ".", rsdp->revision);