Commit 8370af20 authored by Li Ming's avatar Li Ming Committed by Dan Williams
Browse files

PCI/IDE: Fix off by one error calculating VF RID range



The VF ID range of an SR-IOV device is [0, num_VFs - 1].
pci_ide_stream_alloc() mistakenly uses num_VFs to represent the last ID.
Fix that off by one error to stay in bounds of the range.

Fixes: 1e4d2ff3 ("PCI/IDE: Add IDE establishment helpers")
Signed-off-by: default avatarLi Ming <ming.li@zohomail.com>
Reviewed-by: default avatarXu Yilun <yilun.xu@linux.intel.com>
Link: https://patch.msgid.link/20260114111455.550984-1-ming.li@zohomail.com


Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 731bb311
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -282,8 +282,8 @@ struct pci_ide *pci_ide_stream_alloc(struct pci_dev *pdev)
	/* for SR-IOV case, cover all VFs */
	num_vf = pci_num_vf(pdev);
	if (num_vf)
		rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf),
				    pci_iov_virtfn_devfn(pdev, num_vf));
		rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf - 1),
				    pci_iov_virtfn_devfn(pdev, num_vf - 1));
	else
		rid_end = pci_dev_id(pdev);

+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ enum pci_ide_partner_select {
/**
 * struct pci_ide_partner - Per port pair Selective IDE Stream settings
 * @rid_start: Partner Port Requester ID range start
 * @rid_end: Partner Port Requester ID range end
 * @rid_end: Partner Port Requester ID range end (inclusive)
 * @stream_index: Selective IDE Stream Register Block selection
 * @mem_assoc: PCI bus memory address association for targeting peer partner
 * @pref_assoc: PCI bus prefetchable memory address association for