From 80e02c97080329ddcbb620b5e977ade78a7f1bea Mon Sep 17 00:00:00 2001 From: Liang Yang Date: Wed, 17 Oct 2018 19:49:07 +0800 Subject: [PATCH] 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 Reviewed-by: Xiaoguang Wu Acked-by: Yu Wang --- devicemodel/hw/pci/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 devicemodel/hw/pci/xhci.c diff --git a/devicemodel/hw/pci/xhci.c b/devicemodel/hw/pci/xhci.c old mode 100755 new mode 100644 index b09b3cb9a..70f364019 --- a/devicemodel/hw/pci/xhci.c +++ b/devicemodel/hw/pci/xhci.c @@ -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;