dmicheck: fix Maximum Capacity checking range
diff mbox series

Message ID 1537945691-27263-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show
Series
  • dmicheck: fix Maximum Capacity checking range
Related show

Commit Message

ivanhu Sept. 26, 2018, 7:08 a.m. UTC
The SMBIOS spec define this field,
If the capacity is not represented in this field, then
this field contains 8000 0000h and the Extended
Maximum Capacity field should be used.

It allow the value 80000000h, when the Extended
Maximum Capacity field is used.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/dmi/dmicheck/dmicheck.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Colin King Sept. 26, 2018, 3:21 p.m. UTC | #1
On 26/09/18 08:08, Ivan Hu wrote:
> The SMBIOS spec define this field,
> If the capacity is not represented in this field, then
> this field contains 8000 0000h and the Extended
> Maximum Capacity field should be used.
> 
> It allow the value 80000000h, when the Extended
> Maximum Capacity field is used.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index d0096bd..ba6f03c 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1512,7 +1512,7 @@ static void dmicheck_entry(fwts_framework *fw,
>  					data[0x4], table, addr, "Location", 0x4);
>  			dmi_min_max_uint8_check(fw, table, addr, "Use", hdr, 0x5, 0x1, 0x7);
>  			dmi_min_max_uint8_check(fw, table, addr, "Error Corrrection Type", hdr, 0x6, 0x1, 0x7);
> -			dmi_min_max_uint32_check(fw, table, addr, "Maximum Capacity", hdr, 0x7, 0, 0x80000000 - 1);
> +			dmi_min_max_uint32_check(fw, table, addr, "Maximum Capacity", hdr, 0x7, 0, 0x80000000);
>  			if (hdr->length < 0x17)
>  				break;
>  			if (GET_UINT64(data + 0xf) != 0 && GET_UINT32(data + 0x7) != 0x80000000)
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung Oct. 2, 2018, 12:10 a.m. UTC | #2
On 2018-09-26 03:08 PM, Ivan Hu wrote:
> The SMBIOS spec define this field,
> If the capacity is not represented in this field, then
> this field contains 8000 0000h and the Extended
> Maximum Capacity field should be used.
> 
> It allow the value 80000000h, when the Extended
> Maximum Capacity field is used.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index d0096bd..ba6f03c 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -1512,7 +1512,7 @@ static void dmicheck_entry(fwts_framework *fw,
>  					data[0x4], table, addr, "Location", 0x4);
>  			dmi_min_max_uint8_check(fw, table, addr, "Use", hdr, 0x5, 0x1, 0x7);
>  			dmi_min_max_uint8_check(fw, table, addr, "Error Corrrection Type", hdr, 0x6, 0x1, 0x7);
> -			dmi_min_max_uint32_check(fw, table, addr, "Maximum Capacity", hdr, 0x7, 0, 0x80000000 - 1);
> +			dmi_min_max_uint32_check(fw, table, addr, "Maximum Capacity", hdr, 0x7, 0, 0x80000000);
>  			if (hdr->length < 0x17)
>  				break;
>  			if (GET_UINT64(data + 0xf) != 0 && GET_UINT32(data + 0x7) != 0x80000000)
> 


Acked-by: Alex Hung <alex.hung@canonical.com>

Patch
diff mbox series

diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
index d0096bd..ba6f03c 100644
--- a/src/dmi/dmicheck/dmicheck.c
+++ b/src/dmi/dmicheck/dmicheck.c
@@ -1512,7 +1512,7 @@  static void dmicheck_entry(fwts_framework *fw,
 					data[0x4], table, addr, "Location", 0x4);
 			dmi_min_max_uint8_check(fw, table, addr, "Use", hdr, 0x5, 0x1, 0x7);
 			dmi_min_max_uint8_check(fw, table, addr, "Error Corrrection Type", hdr, 0x6, 0x1, 0x7);
-			dmi_min_max_uint32_check(fw, table, addr, "Maximum Capacity", hdr, 0x7, 0, 0x80000000 - 1);
+			dmi_min_max_uint32_check(fw, table, addr, "Maximum Capacity", hdr, 0x7, 0, 0x80000000);
 			if (hdr->length < 0x17)
 				break;
 			if (GET_UINT64(data + 0xf) != 0 && GET_UINT32(data + 0x7) != 0x80000000)