diff mbox series

[3/4] dmicheck: update Usage and Characteristics 2 fields in Type 9

Message ID 1530320156-8606-4-git-send-email-alex.hung@canonical.com
State Accepted
Headers show
Series dmicheck: update supports to SMBIOS 3.2 | expand

Commit Message

Alex Hung June 30, 2018, 12:55 a.m. UTC
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/dmi/dmicheck/dmicheck.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Colin Ian King July 2, 2018, 6:46 a.m. UTC | #1
On 30/06/18 01:55, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 522f590..b508799 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1345,17 +1345,13 @@ static void dmicheck_entry(fwts_framework *fw,
>  					"field '%s', offset 0x%2.2x",
>  					data[0x5], table, addr, "Slot Type", 0x5);
>  			dmi_min_max_uint8_check(fw, table, addr, "Slot Data Bus Width", hdr, 0x6, 0x1, 0xe);
> -			dmi_min_max_uint8_check(fw, table, addr, "Current Usage", hdr, 0x7, 0x1, 0x4);
> +			dmi_min_max_uint8_check(fw, table, addr, "Current Usage", hdr, 0x7, 0x1, 0x5);
>  			dmi_min_max_uint8_check(fw, table, addr, "Slot Length", hdr, 0x8, 0x1, 0x6);
>  			if (hdr->length < 0x0d)
>  				break;
> -			if (data[0xc] & 0xf8)
> -				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
> -					"Reserved bits 0x%2.2" PRIx8 " was used"
> -					"bits 3..7 would be reserved while accessing entry '%s' @ "
> -					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
> -					data[0xc],
> -					table, addr, "Slot Characteristics 2", 0xc);
> +
> +			dmi_reserved_bits_check(fw, table, addr, "Slot Characteristics 2", hdr, sizeof(uint8_t), 0x0c, 4, 7);
> +
>  			if (hdr->length < 0x11)
>  				break;
>  			if (!((data[0x5] == 0x06) ||
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu July 3, 2018, 9:27 a.m. UTC | #2
On 06/30/2018 08:55 AM, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 522f590..b508799 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1345,17 +1345,13 @@ static void dmicheck_entry(fwts_framework *fw,
>  					"field '%s', offset 0x%2.2x",
>  					data[0x5], table, addr, "Slot Type", 0x5);
>  			dmi_min_max_uint8_check(fw, table, addr, "Slot Data Bus Width", hdr, 0x6, 0x1, 0xe);
> -			dmi_min_max_uint8_check(fw, table, addr, "Current Usage", hdr, 0x7, 0x1, 0x4);
> +			dmi_min_max_uint8_check(fw, table, addr, "Current Usage", hdr, 0x7, 0x1, 0x5);
>  			dmi_min_max_uint8_check(fw, table, addr, "Slot Length", hdr, 0x8, 0x1, 0x6);
>  			if (hdr->length < 0x0d)
>  				break;
> -			if (data[0xc] & 0xf8)
> -				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
> -					"Reserved bits 0x%2.2" PRIx8 " was used"
> -					"bits 3..7 would be reserved while accessing entry '%s' @ "
> -					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
> -					data[0xc],
> -					table, addr, "Slot Characteristics 2", 0xc);
> +
> +			dmi_reserved_bits_check(fw, table, addr, "Slot Characteristics 2", hdr, sizeof(uint8_t), 0x0c, 4, 7);
> +
>  			if (hdr->length < 0x11)
>  				break;
>  			if (!((data[0x5] == 0x06) ||
Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
index 522f590..b508799 100644
--- a/src/dmi/dmicheck/dmicheck.c
+++ b/src/dmi/dmicheck/dmicheck.c
@@ -1345,17 +1345,13 @@  static void dmicheck_entry(fwts_framework *fw,
 					"field '%s', offset 0x%2.2x",
 					data[0x5], table, addr, "Slot Type", 0x5);
 			dmi_min_max_uint8_check(fw, table, addr, "Slot Data Bus Width", hdr, 0x6, 0x1, 0xe);
-			dmi_min_max_uint8_check(fw, table, addr, "Current Usage", hdr, 0x7, 0x1, 0x4);
+			dmi_min_max_uint8_check(fw, table, addr, "Current Usage", hdr, 0x7, 0x1, 0x5);
 			dmi_min_max_uint8_check(fw, table, addr, "Slot Length", hdr, 0x8, 0x1, 0x6);
 			if (hdr->length < 0x0d)
 				break;
-			if (data[0xc] & 0xf8)
-				fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_RESERVED_VALUE_USED,
-					"Reserved bits 0x%2.2" PRIx8 " was used"
-					"bits 3..7 would be reserved while accessing entry '%s' @ "
-					"0x%8.8" PRIx32 ", field '%s', offset 0x%2.2x",
-					data[0xc],
-					table, addr, "Slot Characteristics 2", 0xc);
+
+			dmi_reserved_bits_check(fw, table, addr, "Slot Characteristics 2", hdr, sizeof(uint8_t), 0x0c, 4, 7);
+
 			if (hdr->length < 0x11)
 				break;
 			if (!((data[0x5] == 0x06) ||