aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target-i386/kvm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index fe67eed0a2..7cdcf31cab 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -45,6 +45,9 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)
cpuid = (struct kvm_cpuid2 *)qemu_mallocz(size);
cpuid->nent = max;
r = kvm_ioctl(s, KVM_GET_SUPPORTED_CPUID, cpuid);
+ if (r == 0 && cpuid->nent >= max) {
+ r = -E2BIG;
+ }
if (r < 0) {
if (r == -E2BIG) {
qemu_free(cpuid);