diff mbox

KVM: Fix off-by-one in overflow check of KVM_ASSIGN_SET_MSIX_NR

Message ID 4DF3423B.1070600@web.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka June 11, 2011, 10:23 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

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>
---
 virt/kvm/assigned-dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Avi Kivity June 13, 2011, 8:48 a.m. UTC | #1
On 06/11/2011 01:23 PM, Jan Kiszka wrote:
> From: Jan Kiszka<jan.kiszka@siemens.com>
>
> 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.
>

Applied, thanks.
diff mbox

Patch

diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 6cc4b97..4e9eaeb 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;
 		}