aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
Diffstat (limited to 'target-i386')
-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 5b52de34dd..eb615989ea 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -44,6 +44,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);