* xhci: xhci-mem: off by one in xhci_stream_id_to_ring()
@ 2018-07-04 9:48 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-07-04 9:48 UTC (permalink / raw)
To: Mathias Nyman, Sarah Sharp; +Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors
The > should be >= here so that we don't read one element beyond the end
of the ep->stream_info->stream_rings[] array.
Fixes: e9df17eb1408 ("USB: xhci: Correct assumptions about number of rings per endpoint.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 8a62eee9eee1..ef350c33dc4a 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -595,7 +595,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
if (!ep->stream_info)
return NULL;
- if (stream_id > ep->stream_info->num_streams)
+ if (stream_id >= ep->stream_info->num_streams)
return NULL;
return ep->stream_info->stream_rings[stream_id];
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-04 9:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04 9:48 xhci: xhci-mem: off by one in xhci_stream_id_to_ring() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox