On Tue, Mar 13, 2018 at 02:08:40PM -0600, Keith Busch wrote: > On Tue, Mar 13, 2018 at 05:10:39PM +0000, Lorenzo Pieralisi wrote: > > On Tue, Feb 06, 2018 at 01:22:25PM -0700, Keith Busch wrote: > > > @@ -233,9 +266,11 @@ static int vmd_msi_prepare(struct irq_domain *domain, struct device *dev, > > > struct pci_dev *pdev = to_pci_dev(dev); > > > struct vmd_dev *vmd = vmd_from_bus(pdev->bus); > > > > > > - if (nvec > vmd->msix_count) > > > + if (nvec > vmd->msix_count) { > > > + if (vmd->msix_count > 1) > > > + return vmd->msix_count - 1; > > > return vmd->msix_count; > > > > I am about to apply this patch but I do not understand what's this hunk > > is there for, to me vmd_msi_prepare() should just return an error in > > this code path unless I am getting this wrong. > > The change above is fixing an off-by-one. And since you brought my attention to it, I see the 'if' is off by one. Let me prepare a v3, and I've one other minor optimization to add as well. Thanks, Keith