usb: musb-new: Limit check array index before use
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 30 Sep 2025 15:52:23 +0000 (16:52 +0100)
committerMarek Vasut <marek.vasut+usb@mailbox.org>
Tue, 28 Oct 2025 15:35:05 +0000 (16:35 +0100)
commitd5de67c57e795325a67ec4ca6486654b72ade038
tree24be38fce9dbf01a2f671321e58ee2120b6cd271
parent6ea91bf8055b18b24828c449e33572ca9a9832eb
usb: musb-new: Limit check array index before use

epnum is used as an index into an array. The limit check for this index
should be performed before using it to access an element in the array to
prevent possible bounds overrun.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
drivers/usb/musb-new/musb_gadget_ep0.c