diff mbox

[2/2] dmi: dmicheck: check new offset in spec 3.11

Message ID 1494047339-2607-2-git-send-email-alex.hung@canonical.com
State Accepted
Headers show

Commit Message

Alex Hung May 6, 2017, 5:08 a.m. UTC
Spec 3.11 introduces a new field "Extended BIOS ROM Size".
This checks the reserved bits in this field.

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

Comments

Colin Ian King May 6, 2017, 11:30 a.m. UTC | #1
On 06/05/17 06:08, Alex Hung wrote:
> Spec 3.11 introduces a new field "Extended BIOS ROM Size".
> This checks the reserved bits in this field.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 5b96f5b..369b79d 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1010,6 +1010,16 @@ static void dmicheck_entry(fwts_framework *fw,
>  					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
>  					hdr->data[0x13], table, addr,
>  					"BIOS Characteristics Extension Byte 2", 0x13);
> +			/* new fields in spec 3.11 */
> +			if (hdr->length < 0x1a)
> +				break;
> +			if (GET_UINT16(data + 0x18) & 0x7fff)
> +				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
> +					"Reserved bits 0x%4.4" PRIx16 " was used and "
> +					"bits 14..15 sould be reserved while accessing entry '%s' @ "
> +					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
> +					GET_UINT16(data + 0x18), table, addr,
> +					"BIOS Characteristics Extension Byte 2", 0x18);
>  			break;
>  
>  		case 1: /* 7.2 */
> 
Thanks for adding this check.

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu May 10, 2017, 8:18 a.m. UTC | #2
On 05/06/2017 01:08 PM, Alex Hung wrote:
> Spec 3.11 introduces a new field "Extended BIOS ROM Size".
> This checks the reserved bits in this field.
>
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 5b96f5b..369b79d 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1010,6 +1010,16 @@ static void dmicheck_entry(fwts_framework *fw,
>  					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
>  					hdr->data[0x13], table, addr,
>  					"BIOS Characteristics Extension Byte 2", 0x13);
> +			/* new fields in spec 3.11 */
> +			if (hdr->length < 0x1a)
> +				break;
> +			if (GET_UINT16(data + 0x18) & 0x7fff)
> +				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
> +					"Reserved bits 0x%4.4" PRIx16 " was used and "
> +					"bits 14..15 sould be reserved while accessing entry '%s' @ "
> +					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
> +					GET_UINT16(data + 0x18), table, addr,
> +					"BIOS Characteristics Extension Byte 2", 0x18);
>  			break;
>
>  		case 1: /* 7.2 */
>


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

Patch

diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
index 5b96f5b..369b79d 100644
--- a/src/dmi/dmicheck/dmicheck.c
+++ b/src/dmi/dmicheck/dmicheck.c
@@ -1010,6 +1010,16 @@  static void dmicheck_entry(fwts_framework *fw,
 					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
 					hdr->data[0x13], table, addr,
 					"BIOS Characteristics Extension Byte 2", 0x13);
+			/* new fields in spec 3.11 */
+			if (hdr->length < 0x1a)
+				break;
+			if (GET_UINT16(data + 0x18) & 0x7fff)
+				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
+					"Reserved bits 0x%4.4" PRIx16 " was used and "
+					"bits 14..15 sould be reserved while accessing entry '%s' @ "
+					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
+					GET_UINT16(data + 0x18), table, addr,
+					"BIOS Characteristics Extension Byte 2", 0x18);
 			break;
 
 		case 1: /* 7.2 */