summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-04-05 15:18:52 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-04-16 12:04:09 +0200
commita67188743bc30a3ad1358b8cd0a2a3cb64c10ff9 (patch)
treeae44db6487a03f442a40b8fa188dcc95681b425e
parentaf203be36deb234550c3c8d2cbafbaef0f08ae1b (diff)
downloadfocaccia-qemu-a67188743bc30a3ad1358b8cd0a2a3cb64c10ff9.tar.gz
focaccia-qemu-a67188743bc30a3ad1358b8cd0a2a3cb64c10ff9.zip
xhci: fix address device
Zero-initialize the set-address dummy USBPacket,
also add buffer to avoid sanity checks triggering.

https://bugzilla.redhat.com/show_bug.cgi?id=929019

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/hcd-xhci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index e489059ab8..a26b78ec88 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2139,8 +2139,12 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
         slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
     } else {
         USBPacket p;
+        uint8_t buf[1];
+
         slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
         usb_device_reset(dev);
+        memset(&p, 0, sizeof(p));
+        usb_packet_addbuf(&p, buf, sizeof(buf));
         usb_packet_setup(&p, USB_TOKEN_OUT,
                          usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
                          0, false, false);