On 04/25/2013 04:36 PM, Eric Blake wrote:
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.
Thanks, I've fixed it and pushed it.
Jan