diff mbox

[1/2] dmi: dmicheck: check reserved bits in Type 0

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

Commit Message

Alex Hung May 6, 2017, 5:08 a.m. UTC
BIOS Characteristics Extension Byte 2 (offset 13)'s Bits [5:7]
are reserved, and it is needed to check they are zero.

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

Comments

Colin Ian King May 6, 2017, 11:29 a.m. UTC | #1
On 06/05/17 06:08, Alex Hung wrote:
> BIOS Characteristics Extension Byte 2 (offset 13)'s Bits [5:7]
> are reserved, and it is needed to check they are zero.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 2665ea7..5b96f5b 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1001,6 +1001,15 @@ static void dmicheck_entry(fwts_framework *fw,
>  			dmi_str_check(fw, table, addr, "Vendor", hdr, 0x4);
>  			dmi_str_check(fw, table, addr, "BIOS Version", hdr, 0x5);
>  			dmi_str_check(fw, table, addr, "Release Date", hdr, 0x8);
> +			if (hdr->length < 0x18)
> +				break;
> +			if (hdr->data[0x13] & 0xe0)
> +				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
> +					"Reserved bits 0x%2.2" PRIx8 " was used and "
> +					"bits 5..7 sould be reserved while accessing entry '%s' @ "
> +					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
> +					hdr->data[0x13], table, addr,
> +					"BIOS Characteristics Extension Byte 2", 0x13);
>  			break;
>  
>  		case 1: /* 7.2 */
> 
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:
> BIOS Characteristics Extension Byte 2 (offset 13)'s Bits [5:7]
> are reserved, and it is needed to check they are zero.
>
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 2665ea7..5b96f5b 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1001,6 +1001,15 @@ static void dmicheck_entry(fwts_framework *fw,
>  			dmi_str_check(fw, table, addr, "Vendor", hdr, 0x4);
>  			dmi_str_check(fw, table, addr, "BIOS Version", hdr, 0x5);
>  			dmi_str_check(fw, table, addr, "Release Date", hdr, 0x8);
> +			if (hdr->length < 0x18)
> +				break;
> +			if (hdr->data[0x13] & 0xe0)
> +				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
> +					"Reserved bits 0x%2.2" PRIx8 " was used and "
> +					"bits 5..7 sould be reserved while accessing entry '%s' @ "
> +					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
> +					hdr->data[0x13], table, addr,
> +					"BIOS Characteristics Extension Byte 2", 0x13);
>  			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 2665ea7..5b96f5b 100644
--- a/src/dmi/dmicheck/dmicheck.c
+++ b/src/dmi/dmicheck/dmicheck.c
@@ -1001,6 +1001,15 @@  static void dmicheck_entry(fwts_framework *fw,
 			dmi_str_check(fw, table, addr, "Vendor", hdr, 0x4);
 			dmi_str_check(fw, table, addr, "BIOS Version", hdr, 0x5);
 			dmi_str_check(fw, table, addr, "Release Date", hdr, 0x8);
+			if (hdr->length < 0x18)
+				break;
+			if (hdr->data[0x13] & 0xe0)
+				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
+					"Reserved bits 0x%2.2" PRIx8 " was used and "
+					"bits 5..7 sould be reserved while accessing entry '%s' @ "
+					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
+					hdr->data[0x13], table, addr,
+					"BIOS Characteristics Extension Byte 2", 0x13);
 			break;
 
 		case 1: /* 7.2 */