From: Jan Kiszka Date: Sat, 11 Jun 2011 10:23:55 +0000 (+0200) Subject: KVM: Fix off-by-one in overflow check of KVM_ASSIGN_SET_MSIX_NR X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9f3191aec595ef9f3c80bc96664fd7aef57ef5be;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git KVM: Fix off-by-one in overflow check of KVM_ASSIGN_SET_MSIX_NR KVM_MAX_MSIX_PER_DEV implies that up to that many MSI-X entries can be requested. But the kernel so far rejected already the upper limit. Signed-off-by: Jan Kiszka Signed-off-by: Avi Kivity --- diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 6cc4b97ec458..4e9eaeb518c7 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -617,7 +617,7 @@ static int kvm_vm_ioctl_set_msix_nr(struct kvm *kvm, if (adev->entries_nr == 0) { adev->entries_nr = entry_nr->entry_nr; if (adev->entries_nr == 0 || - adev->entries_nr >= KVM_MAX_MSIX_PER_DEV) { + adev->entries_nr > KVM_MAX_MSIX_PER_DEV) { r = -EINVAL; goto msix_nr_out; }