On Mon, 30 Aug 2010, Jan Beulich wrote:
> >>> On 30.08.10 at 13:25, <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > --- a/xen/arch/x86/domain.c Tue Aug 17 19:32:37 2010 +0100
> > +++ b/xen/arch/x86/domain.c Fri Aug 20 16:47:36 2010 +0100
> > @@ -490,6 +490,16 @@ int arch_domain_create(struct domain *d,
> > if ( !IO_APIC_IRQ(i) )
> > d->arch.irq_pirq[i] = d->arch.pirq_irq[i] = i;
> >
> > + d->arch.pirq_emuirq = xmalloc_array(int, d->nr_pirqs);
> > + d->arch.emuirq_pirq = xmalloc_array(int, nr_irqs);
> > + if ( !d->arch.pirq_emuirq || !d->arch.emuirq_pirq )
> > + goto fail;
> > + memset(d->arch.pirq_emuirq, IRQ_UNBOUND,
> > + d->nr_pirqs * sizeof(*d->arch.pirq_emuirq));
> > + memset(d->arch.emuirq_pirq, IRQ_UNBOUND,
> > + d->nr_pirqs * sizeof(*d->arch.emuirq_pirq));
> > +
> > +
> > if ( (rc = iommu_domain_init(d)) != 0 )
> > goto fail;
> >
>
> Shouldn't this be done for HVM domains only, and should you free
> these arrays both in the error path of that function and in e.g.
> arch_domain_destroy()?
Yes, you are right about that, I'll fix and resend.
>
> Additionally, shouldn't you add a build time check making sure
> that IRQ_UNBOUND is actually suitable for initialization via
> memset() (or alternatively use a loop)?
>
something like typeof?
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|