linux/drivers/vfio/pci
Dan Carpenter 222e684ca7 vfio/pci: make an array larger
Smatch complains about a possible out of bounds error:

	drivers/vfio/pci/vfio_pci_config.c:1241 vfio_cap_init()
	error: buffer overflow 'pci_cap_length' 20 <= 20

The problem is that pci_cap_length[] was defined as large enough to
hold "PCI_CAP_ID_AF + 1" elements.  The code in vfio_cap_init() assumes
it has PCI_CAP_ID_MAX + 1 elements.  Originally, PCI_CAP_ID_AF and
PCI_CAP_ID_MAX were the same but then we introduced PCI_CAP_ID_EA in
commit f80b0ba959 ("PCI: Add Enhanced Allocation register entries")
so now the array is too small.

Let's fix this by making the array size PCI_CAP_ID_MAX + 1.  And let's
make a similar change to pci_ext_cap_length[] for consistency.  Also
both these arrays can be made const.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2015-11-09 08:59:11 -07:00
..
Kconfig vfio: Split virqfd into a separate module for vfio bus drivers 2015-03-17 08:33:38 -06:00
Makefile vfio: initialize the virqfd workqueue in VFIO generic code 2015-03-16 14:08:54 -06:00
vfio_pci_config.c vfio/pci: make an array larger 2015-11-09 08:59:11 -07:00
vfio_pci_intrs.c vfio: move eventfd support code for VFIO_PCI to a separate file 2015-03-16 14:08:54 -06:00
vfio_pci_private.h vfio: move eventfd support code for VFIO_PCI to a separate file 2015-03-16 14:08:54 -06:00
vfio_pci_rdwr.c vfio-pci: Add support for VGA region access 2013-02-18 10:11:13 -07:00
vfio_pci.c vfio: Include No-IOMMU mode 2015-11-04 09:56:16 -07:00