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

Re: [Xen-devel] [PATCH 2 of 2] libxl_pci: verify device is assignable before adding to domain



Doug Magee writes ("[PATCH 2 of 2] libxl_pci: verify device is assignable 
before adding to domain"):
> Previously, libxl__device_pci_add only checked the device to be added against
> the list of currently assigned devices.  This patch changes the behavior to
> check that the device to be assigned is in the list of assignable devices,
> which only includes those owned by pciback and not assigned to another domain.
...
> +    libxl_device_pci *assignable;
> +    int num_assignable, i, rc;
...
> +    assignable = libxl_device_pci_list_assignable(ctx, &num_assignable);
> +

What about failure ?  libxl_device_pci_list_assignable might return
NULL on failure, I think.  So you need to add a check for that.

And in that case it won't assign to num_assignable either, leading to
an uninitialised variable use and possible crash in out.  I think you
should initialise assignable and num_assignable to 0 to avoid this.

> -        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device already attached to a 
> domain");
> +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device is either assigned to 
> another domain, or not owned by pciback");

While you're here, would you please wrap this line to within 75-80
columns ?

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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