diff --git a/sys/amd64/amd64/msi.c b/sys/amd64/amd64/msi.c index 9bbdf833dae3..7be702a861a1 100644 --- a/sys/amd64/amd64/msi.c +++ b/sys/amd64/amd64/msi.c @@ -315,7 +315,7 @@ msi_alloc(device_t dev, int count, int maxcount, int *irqs, int *newirq, /* We need count - cnt more sources starting at index 'cnt'. */ *newirq = cnt; *newcount = count - cnt; - for (j = 0; j < *newirq; j++) { + for (j = 0; j < *newcount; j++) { /* Create a new MSI source. */ msi = malloc(sizeof(struct msi_intsrc), M_MSI, diff --git a/sys/i386/i386/msi.c b/sys/i386/i386/msi.c index 9bbdf833dae3..7be702a861a1 100644 --- a/sys/i386/i386/msi.c +++ b/sys/i386/i386/msi.c @@ -315,7 +315,7 @@ msi_alloc(device_t dev, int count, int maxcount, int *irqs, int *newirq, /* We need count - cnt more sources starting at index 'cnt'. */ *newirq = cnt; *newcount = count - cnt; - for (j = 0; j < *newirq; j++) { + for (j = 0; j < *newcount; j++) { /* Create a new MSI source. */ msi = malloc(sizeof(struct msi_intsrc), M_MSI,