Re: [PATCH v3 1/1] usb: musb: gadget: misplaced out of bounds check

From: Bin Liu
Date: Tue Mar 20 2018 - 14:56:07 EST


Hi,

On Tue, Mar 20, 2018 at 07:42:48PM +0100, Heinrich Schuchardt wrote:
> musb->endpoints[] has array size MUSB_C_NUM_EPS.
> We must check array bounds before accessing the array and not afterwards.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@xxxxxx>
> ---
> v3
> Remove superfluous braces.
> v2
> Only the 4 low bits of epnum are relevant for indexing.
> ---
> drivers/usb/musb/musb_gadget_ep0.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)


Applied. Thanks.

Regards,
-Bin.