diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2021-08-27 11:31:05 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-08-27 10:24:51 +0200 |
commit | b7d509a92bb0216b01f428166be3770d04bbdd87 (patch) | |
tree | b17de25ecdf47b56bc8d629f2e1760ed1a05badc /drivers/usb/host/xhci-mtk.h | |
parent | 452d1ea55c3e621dc94ac8b832c5e00feb59aad4 (diff) |
usb: xhci-mtk: allow bandwidth table rollover
xhci-mtk has 64 slots for periodic bandwidth calculations and each
slot represents byte budgets on a microframe. When an endpoint's
allocation sits on the boundary of the table, byte budgets' slot
can be rolled over but the current implementation doesn't.
This patch allows the microframe index rollover and prevent
out-of-bounds array access.
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20210827033105.26595-1-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-mtk.h')
-rw-r--r-- | drivers/usb/host/xhci-mtk.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h index 9c54a597e66b..4b1ea89f959a 100644 --- a/drivers/usb/host/xhci-mtk.h +++ b/drivers/usb/host/xhci-mtk.h @@ -25,7 +25,8 @@ * round down to the limit value, that means allocating more * bandwidth to it. */ -#define XHCI_MTK_MAX_ESIT 64 +#define XHCI_MTK_MAX_ESIT (1 << 6) +#define XHCI_MTK_BW_INDEX(x) ((x) & (XHCI_MTK_MAX_ESIT - 1)) /** * @fs_bus_bw: array to keep track of bandwidth already used for FS |