summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-03-15 19:09:47 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-03-16 00:10:06 +0100
commit94a49b505d904ee976d999364bf19945eac7b991 (patch)
treef9f991586275be75e13ee64ad3a2e4cc9433b2f1
parentf47dd59ee594e62029a919b20fc048ce8421b0c2 (diff)
downloadqemu-94a49b505d904ee976d999364bf19945eac7b991.tar.gz
usbdump: fix interval retrieval for endpoint
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--hw/usb/dump.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/usb/dump.c b/hw/usb/dump.c
index bff9bcd601..4c6445e379 100644
--- a/hw/usb/dump.c
+++ b/hw/usb/dump.c
@@ -157,8 +157,10 @@ static uint8_t get_ep_interval(USBEndpoint *ep)
assert(ep->ifnum < dev->ninterfaces);
const USBDescIface *iface = dev->ifaces[ep->ifnum];
- assert(ep->nr < iface->bNumEndpoints);
- const USBDescEndpoint *uep = iface->eps + ep->nr;
+ /* EP0 is defined as the Default control pipe */
+ assert(ep->nr > 0);
+ assert(ep->nr <= iface->bNumEndpoints);
+ const USBDescEndpoint *uep = iface->eps + ep->nr - 1;
return uep->bInterval;
}