If we pass just enough entries to KVM_GET_SUPPORTED_CPUID, we would still
fail with -E2BIG due to wrong comparisons.

Cc: Avi Kivity <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
 arch/x86/kvm/x86.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9eff4af..83fef71 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2710,7 +2710,7 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct 
kvm_cpuid2 *cpuid,
                     cpuid->nent);
 
        r = -E2BIG;
-       if (nent >= cpuid->nent)
+       if (nent > cpuid->nent)
                goto out_free;
 
        r = -EFAULT;
-- 
1.7.8.rc3

--
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