diff options
author | John Levon <john.levon@nutanix.com> | 2021-02-02 14:46:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 14:46:05 +0000 |
commit | 5e16631f81984841788ec26fb1eba03f4e898654 (patch) | |
tree | 08d6144f1156b43dae74bee3ab016f4768dc4262 /lib/pci_caps.c | |
parent | e20eaf66d57ef73b3e0ce8d9fe1b7a9efb3df610 (diff) | |
download | libvfio-user-5e16631f81984841788ec26fb1eba03f4e898654.zip libvfio-user-5e16631f81984841788ec26fb1eba03f4e898654.tar.gz libvfio-user-5e16631f81984841788ec26fb1eba03f4e898654.tar.bz2 |
define full PCI Express capability struct (#289)
Define the full-size capability as defined in the specification.
Previously, we were defining the structure as in the form used by PCI Express
Integrated Endpoints. It's reasonable to assume, however, that a vfio-user
device is a normal PCI Express Endpoint connected over a Link.
We'll go further, and define the whole structure, including the slot registers
at the end that are usually only used for Ports.
The presumption here is that it can't hurt to use the larger size: the only way
a client could care is if it presumed the next capability was at a particular
offset from this one, and we must hope nothing is that silly.
This also corrects a buffer overflow: cap_size() in fact disagreed with the
original size of our struct pxcap (found via clang's address sanitizer).
Signed-off-by: John Levon <john.levon@nutanix.com
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/pci_caps.c')
-rw-r--r-- | lib/pci_caps.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pci_caps.c b/lib/pci_caps.c index 991c70e..26a8ba9 100644 --- a/lib/pci_caps.c +++ b/lib/pci_caps.c @@ -98,7 +98,7 @@ cap_size(vfu_ctx_t *vfu_ctx, void *data, bool extended) case PCI_CAP_ID_PM: return PCI_PM_SIZEOF; case PCI_CAP_ID_EXP: - return PCI_CAP_EXP_ENDPOINT_SIZEOF_V2; + return VFIO_USER_PCI_CAP_EXP_SIZEOF; case PCI_CAP_ID_MSIX: return PCI_CAP_MSIX_SIZEOF; case PCI_CAP_ID_VNDR: |