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

Re: [libvirt] [PATCH v2 08/14] libxl: initialize device structures



Marek Marczykowski-Górecki wrote:
> Do not leave uninitialized variables, not all parameters are set in
> libxlMake*.
>
> Signed-off-by: Marek Marczykowski-Górecki <marmarek invisiblethingslab com>
> ---
>  src/libxl/libxl_conf.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index e5d8dc5..d654ace 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -522,6 +522,8 @@ libxlMakeDisk(libxlDriverPrivatePtr driver,
>                virDomainDiskDefPtr l_disk,
>                libxl_device_disk *x_disk)
>  {
> +    libxl_device_disk_init(x_disk);
> +
>      if (VIR_STRDUP(x_disk->pdev_path, l_disk->src) < 0)
>          return -1;
>  
> @@ -659,6 +661,8 @@ libxlMakeNic(libxlDriverPrivatePtr driver,
>       * x_nics[i].mtu = 1492;
>       */
>  
> +    libxl_device_nic_init(x_nic);
> +
>      virMacAddrGetRaw(&l_nic->mac, x_nic->mac);
>  
>      if (l_nic->model && !STREQ(l_nic->model, "netfront")) {
> @@ -756,6 +760,8 @@ libxlMakeVfb(libxlDriverPrivatePtr driver,
>               virDomainGraphicsDefPtr l_vfb,
>               libxl_device_vfb *x_vfb)
>  {
> +    libxl_device_vfb_init(x_vfb);
>   

This was already being called in libxlMakeVfbList, but agreed it is
better called here.  I rebased the patch, removed the extra
libxl_device_vfb_init call in libxlMakeVfbList, and pushed the patch.

Regards,
Jim

> +
>      switch (l_vfb->type) {
>          case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
>              if (libxlMakeSDLInfo(l_vfb, &x_vfb->sdl) < 0)
> @@ -859,6 +865,8 @@ libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
>                         virDomainDefPtr def, libxl_domain_config *d_config)
>  {
>  
> +    libxl_domain_config_init(d_config);
> +
>      if (libxlMakeDomCreateInfo(driver, def, &d_config->c_info) < 0)
>          return -1;
>  
>   


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