On Mon, Jan 12, 2009 at 10:49:25AM +0000, Amit Shah wrote:
> CPUID functions 4, 0xb and 0xd behave differently for different values of ECX.
> Store these values if userspace passes them.
> 
> Signed-off-by: Amit Shah <[email protected]>
> ---
>  arch/x86/kvm/x86.c |   18 +++++++++++++++---
>  1 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 06b44fb..8dc4b29 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1126,7 +1126,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu 
> *vcpu,
>                                   struct kvm_cpuid *cpuid,
>                                   struct kvm_cpuid_entry __user *entries)
>  {
> -     int r, i;
> +     int r, i, count;
>       struct kvm_cpuid_entry *cpuid_entries;
>  
>       r = -E2BIG;
> @@ -1146,8 +1146,20 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu 
> *vcpu,
>               vcpu->arch.cpuid_entries[i].ebx = cpuid_entries[i].ebx;
>               vcpu->arch.cpuid_entries[i].ecx = cpuid_entries[i].ecx;
>               vcpu->arch.cpuid_entries[i].edx = cpuid_entries[i].edx;
> -             vcpu->arch.cpuid_entries[i].index = 0;
> -             vcpu->arch.cpuid_entries[i].flags = 0;
> +             switch (cpuid_entries[i].function) {
> +             case 4:
> +             case 0xb:
> +             case 0xd:
> +                     vcpu->arch.cpuid_entries[i].index = count++;

Isn't this using count uninitialized?

Cheers,
Muli
-- 
SYSTOR 2009---The Israeli Experimental Systems Conference
May 4-6, 2009, Haifa, Israel
http://www.haifa.il.ibm.com/conferences/systor2009/
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to