On 27/02/15 14:44, Ian Campbell wrote: > On Fri, 2015-02-27 at 14:33 +0000, Julien Grall wrote: >> Hi Ian, >> >> On 20/02/15 17:09, Julien Grall wrote: >>> On 20/02/15 15:52, Ian Campbell wrote: >>>>> >>>>> action = xmalloc(struct irqaction); >>>>> - if (!action) >>>>> + if ( !action ) >>>>> + return -ENOMEM; >>>>> + >>>>> + info = xmalloc(struct irq_guest); >>>> >>>> FWIW you might (subject to sizing/alignment needs) be able to do >>>> action = _xmalloc(sizeof(struct irqaction) + sizeof(struct irq_guest); >>>> info = (sturct irq_guest *)(action + 1); >>>> >>>> which would save some memory overhead for free pointers etc and allow >>>> you to avoid manually managing the info. >>>> >>>> You probably won't like that though, so feel free to ignore. >>> >>> Actually it's a good idea :). I haven't though about it. >> >> I though about it. The pointer to irq_guest may not be correctly aligned >> with this solution, right? > > It depends on sizeof(struct irqaction) (which is what I meant by > "subject to..."). t'd probably need a ROUNDUP(sizeof(foo), > pointer-alignement) in there somewhere.
Oh right, I missed the parentheses part. The pointer alignment is not the same on ARM32 and ARM64, I need to think more about it. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel