summaryrefslogtreecommitdiffstats
path: root/hw/usb/hcd-xhci.c
diff options
context:
space:
mode:
authorPeter Maydell2016-03-22 17:42:06 +0100
committerPeter Maydell2016-03-22 17:42:06 +0100
commitac0d25e843bdad441db2a26f78898f533bf91bb5 (patch)
tree8aba27d380262f23b2d2a8fc9d156cb706f89800 /hw/usb/hcd-xhci.c
parentMerge remote-tracking branch 'remotes/berrange/tags/pull-crypto-2016-03-21-1'... (diff)
parentusb: ehci: add capability mmio write function (diff)
downloadqemu-ac0d25e843bdad441db2a26f78898f533bf91bb5.tar.gz
qemu-ac0d25e843bdad441db2a26f78898f533bf91bb5.tar.xz
qemu-ac0d25e843bdad441db2a26f78898f533bf91bb5.zip
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20160321-1' into staging
usb: bugfix collection. # gpg: Signature made Mon 21 Mar 2016 11:07:39 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-usb-20160321-1: usb: ehci: add capability mmio write function hw/usb/dev-mtp: Guard inotify usage with CONFIG_INOTIFY1 usb: fix unbound stack warning for inotify_watchfn usb: fix unbound stack usage for usb_mtp_add_str usb: fix unbounded stack warning for xhci_dma_write_u32s usb: Fix compilation for Windows Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb/hcd-xhci.c')
-rw-r--r--hw/usb/hcd-xhci.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 44b6f8c03d..bcde8a2f48 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -698,11 +698,13 @@ static inline void xhci_dma_write_u32s(XHCIState *xhci, dma_addr_t addr,
uint32_t *buf, size_t len)
{
int i;
- uint32_t tmp[len / sizeof(uint32_t)];
+ uint32_t tmp[5];
+ uint32_t n = len / sizeof(uint32_t);
assert((len % sizeof(uint32_t)) == 0);
+ assert(n <= ARRAY_SIZE(tmp));
- for (i = 0; i < (len / sizeof(uint32_t)); i++) {
+ for (i = 0; i < n; i++) {
tmp[i] = cpu_to_le32(buf[i]);
}
pci_dma_write(PCI_DEVICE(xhci), addr, tmp, len);