History

KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce

Bank_num is a one-based count of banks, not a zero-based index. It overflows the allocated space only when strictly greater than KVM_MAX_MCE_BANKS.

Jim Mattson committed 6 years ago

Commit c4e0e4a1 parent f6bfd9c1 file · +1 −1Browse files

Unified · Split

arch/x86/kvm/x86.c+1−1
@@ -3759,7 +3759,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu, · 3758 unmodified lines
3759 unsigned bank_num = mcg_cap & 0xff, bank;3759 unsigned bank_num = mcg_cap & 0xff, bank;
3760 3760
3761 r = -EINVAL;3761 r = -EINVAL;
3762 if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS)3762 if (!bank_num || bank_num > KVM_MAX_MCE_BANKS)
3763 goto out;3763 goto out;
3764 if (mcg_cap & ~(kvm_mce_cap_supported | 0xff | 0xff0000))3764 if (mcg_cap & ~(kvm_mce_cap_supported | 0xff | 0xff0000))
3765 goto out;3765 goto out;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t