DM USB: xHCI: Fix an potential array out of range issue.

When usb device numbers reach up to XHCI_MAX_SLOTS. The slot_allocated
array will get out of range. This patch is used to fix this issue.

Tracked-On: #1479
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Liang Yang 2018-10-17 19:49:07 +08:00 committed by wenlingz
parent 84c0c87842
commit 80e02c9708
1 changed files with 1 additions and 1 deletions

2
devicemodel/hw/pci/xhci.c Executable file → Normal file
View File

@ -373,7 +373,7 @@ struct pci_xhci_vdev {
struct pci_xhci_dev_emu **devices; /* XHCI[port] = device */
struct pci_xhci_dev_emu **slots; /* slots assigned from 1 */
bool slot_allocated[XHCI_MAX_SLOTS];
bool slot_allocated[XHCI_MAX_SLOTS + 1];
int ndevices;
uint16_t pid;
uint16_t vid;