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

Re: [Xen-devel] [PATCH v5 12/17] Update IRTE according to guest interrupt config changes



>>> On 13.08.15 at 03:37, <feng.wu@xxxxxxxxx> wrote:
>> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@xxxxxxxxxx]
>> Sent: Thursday, August 13, 2015 12:43 AM
>> On Wed, Aug 12, 2015 at 10:35:33AM +0800, Feng Wu wrote:
>> > +    }
>> > +
>> > +    if ( dest_vcpu_num != 0 )
>> > +    {
>> > +        idx = 0;
>> > +
>> > +        for ( i = gvec % dest_vcpu_num; i >= 0; i--)
>> 
>> That loop is not good as it will overflow.
>> 
>> Imagine gvec = 40, dest_vcpu_num = 2
>> On first iteration i = 0, on the next i = -1 (aka 0xfffffff), and so on.
>> 
> 
> So we should define 'i' as int, right?

No, you should fix the loop. 'i' can't validly hold negative values.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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