From 94a49b505d904ee976d999364bf19945eac7b991 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 15 Mar 2014 19:09:47 +0100 Subject: usbdump: fix interval retrieval for endpoint Signed-off-by: Peter Wu --- hw/usb/dump.c | 6 ++++-- 1 file 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; } -- cgit v1.2.1