diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2024-06-27 15:07:54 +0900 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2024-07-03 18:14:07 -0400 |
commit | 77718701157f6ca77ea7a57b536fa0a22f676082 (patch) | |
tree | 3dce0b19d3e760eb9adb5d07a8afcddc2c0a23fe /include/hw/pci | |
parent | c613ad25125bf3016aa8f81ce170f5ac91d2379f (diff) | |
download | qemu-77718701157f6ca77ea7a57b536fa0a22f676082.zip qemu-77718701157f6ca77ea7a57b536fa0a22f676082.tar.gz qemu-77718701157f6ca77ea7a57b536fa0a22f676082.tar.bz2 |
pcie_sriov: Ensure VF function number does not overflow
pci_new() aborts when creating a VF with a function number equals to or
is greater than PCI_DEVFN_MAX.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20240627-reuse-v10-5-7ca0b8ed3d9f@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/pci')
-rw-r--r-- | include/hw/pci/pcie_sriov.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 450cbef..aa704e8 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -27,10 +27,11 @@ typedef struct PCIESriovVF { uint16_t vf_number; /* Logical VF number of this function */ } PCIESriovVF; -void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, uint16_t init_vfs, uint16_t total_vfs, - uint16_t vf_offset, uint16_t vf_stride); + uint16_t vf_offset, uint16_t vf_stride, + Error **errp); void pcie_sriov_pf_exit(PCIDevice *dev); /* Set up a VF bar in the SR/IOV bar area */ |