qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/smbios: fix offset of type 3 sku field
@ 2019-02-15 15:36 Daniel P. Berrangé
  2019-02-15 16:40 ` Igor Mammedov
  2019-02-15 20:33 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2019-02-15 15:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Michael S. Tsirkin, Daniel P. Berrangé

The type 3 SMBIOS structure[1] ends with fields

  ...
  0x14  - contained element count
  0x15  - contained element record length
  0x16  - sku number

The smbios_type_3 struct missed the contained element record
length field, causing sku number to be reported at the wrong
offset.

[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/smbios/smbios.c           | 1 +
 include/hw/firmware/smbios.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 818be8a838..47be9071fa 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -563,6 +563,7 @@ static void smbios_build_type_3_table(void)
     t->height = 0;
     t->number_of_power_cords = 0;
     t->contained_element_count = 0;
+    t->contained_element_record_length = 0;
     SMBIOS_TABLE_SET_STR(3, sku_number_str, type3.sku);
 
     SMBIOS_BUILD_TABLE_POST;
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index eeb5a4d7b6..6fef32a3c9 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -162,6 +162,7 @@ struct smbios_type_3 {
     uint8_t height;
     uint8_t number_of_power_cords;
     uint8_t contained_element_count;
+    uint8_t contained_element_record_length;
     uint8_t sku_number_str;
     /* contained elements follow */
 } QEMU_PACKED;
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/smbios: fix offset of type 3 sku field
  2019-02-15 15:36 [Qemu-devel] [PATCH] hw/smbios: fix offset of type 3 sku field Daniel P. Berrangé
@ 2019-02-15 16:40 ` Igor Mammedov
  2019-02-15 20:33 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Mammedov @ 2019-02-15 16:40 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel, Michael S. Tsirkin

On Fri, 15 Feb 2019 15:36:00 +0000
Daniel P. Berrangé <berrange@redhat.com> wrote:

> The type 3 SMBIOS structure[1] ends with fields
> 
>   ...
>   0x14  - contained element count
>   0x15  - contained element record length
>   0x16  - sku number
> 
> The smbios_type_3 struct missed the contained element record
> length field, causing sku number to be reported at the wrong
> offset.
> 
> [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/smbios/smbios.c           | 1 +
>  include/hw/firmware/smbios.h | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 818be8a838..47be9071fa 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -563,6 +563,7 @@ static void smbios_build_type_3_table(void)
>      t->height = 0;
>      t->number_of_power_cords = 0;
>      t->contained_element_count = 0;
> +    t->contained_element_record_length = 0;
>      SMBIOS_TABLE_SET_STR(3, sku_number_str, type3.sku);
>  
>      SMBIOS_BUILD_TABLE_POST;
> diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
> index eeb5a4d7b6..6fef32a3c9 100644
> --- a/include/hw/firmware/smbios.h
> +++ b/include/hw/firmware/smbios.h
> @@ -162,6 +162,7 @@ struct smbios_type_3 {
>      uint8_t height;
>      uint8_t number_of_power_cords;
>      uint8_t contained_element_count;
> +    uint8_t contained_element_record_length;
>      uint8_t sku_number_str;
>      /* contained elements follow */
>  } QEMU_PACKED;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/smbios: fix offset of type 3 sku field
  2019-02-15 15:36 [Qemu-devel] [PATCH] hw/smbios: fix offset of type 3 sku field Daniel P. Berrangé
  2019-02-15 16:40 ` Igor Mammedov
@ 2019-02-15 20:33 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-15 20:33 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel; +Cc: Igor Mammedov, Michael S. Tsirkin

On 2/15/19 4:36 PM, Daniel P. Berrangé wrote:
> The type 3 SMBIOS structure[1] ends with fields
> 
>   ...
>   0x14  - contained element count
>   0x15  - contained element record length
>   0x16  - sku number
> 
> The smbios_type_3 struct missed the contained element record
> length field, causing sku number to be reported at the wrong
> offset.
> 
> [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf
> 

Fixes: e41fca3da72

> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/smbios/smbios.c           | 1 +
>  include/hw/firmware/smbios.h | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 818be8a838..47be9071fa 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -563,6 +563,7 @@ static void smbios_build_type_3_table(void)
>      t->height = 0;
>      t->number_of_power_cords = 0;
>      t->contained_element_count = 0;
> +    t->contained_element_record_length = 0;
>      SMBIOS_TABLE_SET_STR(3, sku_number_str, type3.sku);
>  
>      SMBIOS_BUILD_TABLE_POST;
> diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
> index eeb5a4d7b6..6fef32a3c9 100644
> --- a/include/hw/firmware/smbios.h
> +++ b/include/hw/firmware/smbios.h
> @@ -162,6 +162,7 @@ struct smbios_type_3 {
>      uint8_t height;
>      uint8_t number_of_power_cords;
>      uint8_t contained_element_count;
> +    uint8_t contained_element_record_length;
>      uint8_t sku_number_str;
>      /* contained elements follow */
>  } QEMU_PACKED;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-15 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 15:36 [Qemu-devel] [PATCH] hw/smbios: fix offset of type 3 sku field Daniel P. Berrangé
2019-02-15 16:40 ` Igor Mammedov
2019-02-15 20:33 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).