Re: [PATCH v2] KVM: Refactor and simplify kvm_dev_ioctl_get_supported_cpuid

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

 



On 11/28/2011 11:52 AM, Avi Kivity wrote:
> On 11/28/2011 11:20 AM, Sasha Levin wrote:
> > This patch cleans and simplifies kvm_dev_ioctl_get_supported_cpuid by using a table
> > instead of duplicating code as Avi suggested.
> >
> > This patch also fixes a bug where kvm_dev_ioctl_get_supported_cpuid would return
> > -E2BIG when amount of entries passed was just right.
> >
> >  	do_cpuid_1_ent(entry, function, index);
> >  	++*nent;
> >  
> > @@ -275,7 +282,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
> >  
> >  		entry->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
> >  		entry->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
> > -		for (t = 1; t < times && *nent < maxnent; ++t) {
> > +		for (t = 1; t < times; ++t) {
> > +			if (*nent >= maxnent)
> > +				goto out;
> > +
> >  			do_cpuid_1_ent(&entry[t], function, 0);
> >  			entry[t].flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
> >  			++*nent;
>
> Please move the check into do_cpuid_1_ent(); it's more consistent.
>
>

Given that do_cpuid_1_ent() doesn't receive nent/maxent, I applied this;
thanks.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux