Re: [patch] vfio: make an array larger

2015-11-04 Thread walter harms
Am 04.11.2015 14:26, schrieb Dan Carpenter: > 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 > > Fix this by making the array larger. > > Signed-off-by: Dan

[patch] vfio: make an array larger

2015-11-04 Thread Dan Carpenter
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 Fix this by making the array larger. Signed-off-by: Dan Carpenter diff --git

Re: [patch] vfio: make an array larger

2015-11-04 Thread Alex Williamson
On Wed, 2015-11-04 at 16:26 +0300, Dan Carpenter wrote: > 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 > > Fix this by making the array larger. > > Signed-off-by:

Re: [patch] vfio: make an array larger

2015-11-04 Thread Joe Perches
On Wed, 2015-11-04 at 16:26 +0300, Dan Carpenter wrote: > 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 > > Fix this by making the array larger. > > Signed-off-by:

Re: [patch] vfio: make an array larger

2015-11-04 Thread Alex Williamson
On Wed, 2015-11-04 at 21:20 +0300, Dan Carpenter wrote: > Sorry, I should have said that I am on linux-next at the start. > > > > -static u8 pci_cap_length[] = { > > > +static u8 pci_cap_length[PCI_CAP_ID_MAX + 1] = { > > > [PCI_CAP_ID_BASIC] = PCI_STD_HEADER_SIZEOF, /* pci config header

Re: [patch] vfio: make an array larger

2015-11-04 Thread Dan Carpenter
On Wed, Nov 04, 2015 at 08:40:19AM -0800, Joe Perches wrote: > Doesn't the same thing happen with pci_ext_cap_length? pci_ext_cap_length is fine as-is but you're right that we probably should make the size explicit as well. I will fix and resend. > Both array declarations might be better as

Re: [patch] vfio: make an array larger

2015-11-04 Thread Dan Carpenter
Sorry, I should have said that I am on linux-next at the start. > > -static u8 pci_cap_length[] = { > > +static u8 pci_cap_length[PCI_CAP_ID_MAX + 1] = { > > [PCI_CAP_ID_BASIC] = PCI_STD_HEADER_SIZEOF, /* pci config header */ > > [PCI_CAP_ID_PM] = PCI_PM_SIZEOF, > >