Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 1e4d2ff3ae45 ("PCI/IDE: Add IDE establishment helpers")
Signed-off-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Xu Yilun <yilun.xu@linux.intel.com>
Link: https://patch.msgid.link/20260114111455.550984-1-ming.li@zohomail.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

authored by

Li Ming and committed by
Dan Williams
8370af20 731bb311

+3 -3
+2 -2
drivers/pci/ide.c
··· 282 282 /* for SR-IOV case, cover all VFs */ 283 283 num_vf = pci_num_vf(pdev); 284 284 if (num_vf) 285 - rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf), 286 - pci_iov_virtfn_devfn(pdev, num_vf)); 285 + rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf - 1), 286 + pci_iov_virtfn_devfn(pdev, num_vf - 1)); 287 287 else 288 288 rid_end = pci_dev_id(pdev); 289 289
+1 -1
include/linux/pci-ide.h
··· 26 26 /** 27 27 * struct pci_ide_partner - Per port pair Selective IDE Stream settings 28 28 * @rid_start: Partner Port Requester ID range start 29 - * @rid_end: Partner Port Requester ID range end 29 + * @rid_end: Partner Port Requester ID range end (inclusive) 30 30 * @stream_index: Selective IDE Stream Register Block selection 31 31 * @mem_assoc: PCI bus memory address association for targeting peer partner 32 32 * @pref_assoc: PCI bus prefetchable memory address association for