usb: chipidea: host: fix port index underflow and UBSAN complains
If wIndex is 0 (and it often is), these calculations underflow and UBSAN complains, here resolve this by not decrementing the index when it is equal to 0, this copies the solution from commit 85e3990b ("USB: EHCI: avoid undefined pointer arithmetic and placate UBSAN") Reported-by: NZhipeng Wang <zhipeng.wang_1@nxp.com> Signed-off-by: NLi Jun <jun.li@nxp.com> Link: https://lore.kernel.org/r/1624004938-2399-1-git-send-email-jun.li@nxp.comSigned-off-by: NPeter Chen <peter.chen@kernel.org>
Showing
想要评论请 注册 或 登录