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

Re: [Xen-devel] [PATCH] hvmloader: support system enclosure asset tag (SMBIOS type 3)



>>> On 21.08.17 at 10:16, <vivek.kumar.chaubey@xxxxxxxxx> wrote:
> --- a/tools/firmware/hvmloader/smbios.c
> +++ b/tools/firmware/hvmloader/smbios.c
> @@ -531,6 +531,7 @@ smbios_type_3_init(void *start)
>      const char *s;
>      void *pts;
>      uint32_t length;
> +    uint32_t counter = 1;

I think having the counter start at zero (using ++counter
everywhere below) would be more natural.

> @@ -562,13 +563,20 @@ smbios_type_3_init(void *start)
>      strcpy((char *)start, s);
>      start += strlen(s) + 1;
>  
> -    /* No internal defaults for this if the value is not set */
> +    /* No internal defaults for followings if the value is not set */

s/followings/following ones/ ?

>      s = xenstore_read(HVM_XS_ENCLOSURE_SERIAL_NUMBER, NULL);
>      if ( (s != NULL)&&(*s != '\0') )
>      {
>          strcpy((char *)start, s);
>          start += strlen(s) + 1;
> -        p->serial_number_str = 2;
> +        p->serial_number_str = counter++;
> +    }
> +    s = xenstore_read(HVM_XS_ENCLOSURE_ASSET_TAG, NULL);
> +    if ( (s != NULL)&&(*s != '\0') )

Please don't copy style violations (here: missing blanks) or ...

> +    {
> +        strcpy((char *)start, s);

... things rendering the code fragile (here: pointless cast).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.