dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] [PATCH 2/4] dmidecode: Some OEM records require Product


From: Jean Delvare
Subject: Re: [dmidecode] [PATCH 2/4] dmidecode: Some OEM records require Product Name
Date: Fri, 27 Nov 2020 15:37:09 +0100

Hi Jerry,

On Thu, 19 Nov 2020 12:55:14 -0700, Jerry Hoemann wrote:
> Decoding of OEM records can depend upon the product in addition
> to the manufacturer.  So, save "Product Name" from type 1 record
> in addition to "Manufacturer" in dmi_set_vendor.
> 
> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> ---
>  dmidecode.c | 4 ++--
>  dmioem.c    | 5 ++++-
>  dmioem.h    | 2 +-
>  3 files changed, 7 insertions(+), 4 deletions(-)
> (...)
> --- a/dmidecode.c
> +++ b/dmidecode.c
> @@ -5242,8 +5242,8 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, 
> u16 ver, u32 flags)
>               }
>  
>               /* assign vendor for vendor-specific decodes later */
> -             if (h.type == 1 && h.length >= 5)
> -                     dmi_set_vendor(dmi_string(&h, data[0x04]));
> +             if (h.type == 1 && h.length >= 6)
> +                     dmi_set_vendor(dmi_string(&h, data[0x04]), 
> dmi_string(&h, data[0x5]));

Looking at this now, I think we should be calling _dmi_string()
instead, as these strings will be used for comparison purposes only and
will never be displayed. The issue predates your changes though, so
don't bother with that, I'll fix it myself afterwards.

>  
>               /* Fixup a common mistake */
>               if (h.type == 34)
> diff --git a/dmioem.c b/dmioem.c
> index beb3df0..36820e4 100644
> --- a/dmioem.c
> +++ b/dmioem.c
> (...)
> -void dmi_set_vendor(const char *s)
> +void dmi_set_vendor(const char *s, const char *p)
>  {
>       int len;
>  
> @@ -70,6 +71,8 @@ void dmi_set_vendor(const char *s)
>               dmi_vendor = VENDOR_IBM;
>       else if (strncmp(s, "LENOVO", len) == 0)
>               dmi_vendor = VENDOR_LENOVO;
> +
> +     dmi_product = p;
>  }

Fine with me. I'll probably rename "s" to something else later though,
originally "s" was for "string" but now that there are 2 string
parameters, this gets confusing.

Applied, thanks.

-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]