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

Re: [PATCH v2 3/3] xl/libxl: Add OEM string support to smbios


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Fri, 9 Sep 2022 11:40:59 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Nick Rosbrook <rosbrookn@xxxxxxxxx>, "Juergen Gross" <jgross@xxxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 10:41:19 +0000
  • Ironport-data: A9a23:RwWnCq2Rt4k6xAvxt/bD5dhxkn2cJEfYwER7XKvMYLTBsI5bpzwEz 2QbWm3UafuIZmKmfo8jaYu290hX6sTcmoBqTFNrpC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOKn9RGQ7InQLpLkEunIJyttcgFtTSYlmHpLlvUwx4VlmrBVOSvU0 T/Ji5CZaQTNNwJcaDpOsfrS8EI35pwehRtD1rAATaET1LPhvyF94KI3fcmZM3b+S49IKe+2L 86rIGaRpz6xE78FU7tJo56jGqE4aue60Tum0xK6b5OKkBlazhHe545gXBYqheW7vB3S9zx54 I0lWZVd0m7FNIWU8AgWe0Ew/y2TocSqUVIISJSymZX78qHIT5fj6/dLJ0gMGY4ywc1MDm4Q6 fAbLncrQTnW0opawJrjIgVtrsEqLc2tN4IDoHBwizreCJ7KQ7iaHf+Mv4UBmm5t2IYeRp4yZ OJAAdZrRB3Gfx1IPEZREJ8klf2krnL+bydZuBSeoq9fD237nFQoi+WzboG9ltqiGIJLhEmem Hv89EvTGC4zM4STxD2b7Sf57gPItXyiA99DfFGizdZwh0aZ3GsUCxs+Wl6yoP3/gUm7M/pdJ FYT4TEGtrUp+QqgSdyVdwK8iG6JuFgbQdU4O+8z7g2X27fXywmcD2kACDVGbbQOpMIwADAny FKNt9foHiB09q2YT2qH8bWZpi/0PjIaRVLufgddE1FDuYO65thu0FSfFb6PDZJZkPX3PBr5+ RSJhhMVvLoc09IH1KP823/u1mfESofycuIl2unGdjv7sFknP9f+O9PABUvztqgZctvAJrWVl D1dwpXFsrhTZX2YvHbVKNjhCo1F8Bps3Nf0pVd0V6cs+D22k5JIVdABuWouTKuF3yttRNMIX KMwkVkLjHOrFCH2BZKbmqroYyjQ8YDuFM7+StffZcdUb556eWevpX8wPxDOhTmyyhFxzsnT3 Kt3lu71VR4n5VlPlmLqF4/xL5dwrszB+Y8jbc+ilEn2uVZvTHWUVa0EIDOzUwzN14vd+V29z jqqH5HVo/mpeLGhP3K/HE96BQxiEEXX8rit85ULKrbaeFM8cIzjYteIqY4cl0Vet/w9vo/1E ruVAye0FHKXaaX7FDi3
  • Ironport-hdrordr: A9a23:iAJr+KnWtTv3yEls1i9waBsga2HpDfIs3DAbv31ZSRFFG/Fxl6 iV8sjz8SWE7Ar5OUtQ/OxoV5PsfZqxz/JICMwqTNCftWrdyQmVxeNZjbcKqgeIc0aVygce79 YCT0EXMqyXMbEQt6fHCWeDfOod/A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Sep 08, 2022 at 03:51:13PM -0400, Jason Andryuk wrote:
> diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
> index c3125ed310..0b01e09632 100644
> --- a/tools/libs/light/libxl_dom.c
> +++ b/tools/libs/light/libxl_dom.c
> @@ -773,8 +774,18 @@ static int hvm_build_set_xs_values(libxl__gc *gc,
>  
>      for (int i = 0; i < info->u.hvm.num_smbios; i++) {
>          char *p;
> -        path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", domid,
> -                   libxl_smbios_type_to_string(info->u.hvm.smbios[i].key));
> +        if (info->u.hvm.smbios[i].key == LIBXL_SMBIOS_TYPE_OEM) {
> +            if (num_oem > 99) {
> +                ret = ERROR_INVAL;

We probably want to log an error message here, to explain why libxl
returns an error.

> +                goto err;
> +            }
> +            path = GCSPRINTF("/local/domain/%d/"HVM_XS_OEM_STRINGS, domid,
> +                             num_oem);
> +            num_oem++;
> +        } else {
> +            path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", 
> domid,
> +                       
> libxl_smbios_type_to_string(info->u.hvm.smbios[i].key));
> +        }
>  
>          /* Convert libxl_smbios_type string to xenstore path that hvmloader
>             will use, as defined by HVM_XS_*. That is convert the '_' to '-'. 
> */
> diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
> index 5413c36645..d0f8a14827 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -1823,6 +1826,15 @@ void parse_config_data(const char *config_source,
>                  }
>                  free(option);
>  
> +                if (v == LIBXL_SMBIOS_TYPE_OEM) {
> +                    if (num_oem > 99) {
> +                        fprintf(stderr,
> +                                "xl: smbios limited to 99 oem strings\n");
> +                        exit(-ERROR_FAIL);

Could you change the exit value to be EXIT_FAILURE instead, like in the
other patch?
(ERROR_FAIL is meant to be an libxl return value and it somehow spread
to xl.)

Thanks,

-- 
Anthony PERARD



 


Rackspace

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