[libvirt] [PATCH] conf: reject controllers with duplicate indexes
Eric Blake
eblake at redhat.com
Thu Apr 25 14:36:29 UTC 2013
On 04/25/2013 05:41 AM, Ján Tomko wrote:
> Reject multiple controllers with the same index,
> except for USB controllers.
> Multi-function USB controllers can have the same index.
> ---
Compared to the earlier version you posted as patch 6/5 on the pci
patches, you changed to a stack allocation of the bitmaps.
> src/conf/domain_conf.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 59 insertions(+)
>
> +virDomainDefRejectDuplicateControllers(virDomainDefPtr def)
> +{
> + int max_idx[VIR_DOMAIN_CONTROLLER_TYPE_LAST];
> + virBitmapPtr bitmaps[VIR_DOMAIN_CONTROLLER_TYPE_LAST] = { NULL };
> + virDomainControllerDefPtr cont;
> + size_t nbitmaps = 0;
> + int ret = -1;
> + bool b;
> + int i;
> +
> + memset(max_idx, -1, sizeof(max_idx)/sizeof(max_idx[0]));
That's too small. If VIR_DOMAIN_CONTROLLER_TYPE_LAST is 8, it only sets
2 entries and leaves the last 6 uninitialized. You want:
memset(max_idx, -1, sizeof(max_idx));
ACK with the fixed initialization.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130425/70cdacb6/attachment-0001.sig>
More information about the libvir-list
mailing list