diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index be451ee44249..ae07d261527c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1591,6 +1591,8 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, | |||
1591 | 1591 | ||
1592 | if (cpuid->nent < 1) | 1592 | if (cpuid->nent < 1) |
1593 | goto out; | 1593 | goto out; |
1594 | if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) | ||
1595 | cpuid->nent = KVM_MAX_CPUID_ENTRIES; | ||
1594 | r = -ENOMEM; | 1596 | r = -ENOMEM; |
1595 | cpuid_entries = vmalloc(sizeof(struct kvm_cpuid_entry2) * cpuid->nent); | 1597 | cpuid_entries = vmalloc(sizeof(struct kvm_cpuid_entry2) * cpuid->nent); |
1596 | if (!cpuid_entries) | 1598 | if (!cpuid_entries) |
@@ -1690,7 +1692,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu, | |||
1690 | unsigned bank_num = mcg_cap & 0xff, bank; | 1692 | unsigned bank_num = mcg_cap & 0xff, bank; |
1691 | 1693 | ||
1692 | r = -EINVAL; | 1694 | r = -EINVAL; |
1693 | if (!bank_num) | 1695 | if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS) |
1694 | goto out; | 1696 | goto out; |
1695 | if (mcg_cap & ~(KVM_MCE_CAP_SUPPORTED | 0xff | 0xff0000)) | 1697 | if (mcg_cap & ~(KVM_MCE_CAP_SUPPORTED | 0xff | 0xff0000)) |
1696 | goto out; | 1698 | goto out; |
@@ -4049,7 +4051,7 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | |||
4049 | return kvm_write_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu); | 4051 | return kvm_write_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu); |
4050 | } | 4052 | } |
4051 | 4053 | ||
4052 | static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, | 4054 | static gpa_t get_tss_base_addr(struct kvm_vcpu *vcpu, |
4053 | struct desc_struct *seg_desc) | 4055 | struct desc_struct *seg_desc) |
4054 | { | 4056 | { |
4055 | u32 base_addr = get_desc_base(seg_desc); | 4057 | u32 base_addr = get_desc_base(seg_desc); |