KVM: Fix off-by-one in overflow check of KVM_ASSIGN_SET_MSIX_NR
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 11 Jun 2011 10:23:55 +0000 (12:23 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 12 Jul 2011 10:16:18 +0000 (13:16 +0300)
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 <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
virt/kvm/assigned-dev.c

index 6cc4b97ec4581eef917221a264602c49582dc701..4e9eaeb518c7b863f9acc70d13d046edb67f4a04 100644 (file)
@@ -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;
                }