usb: musb: gadget: misplaced out of bounds check

commit af6f852909 upstream.

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@gmx.de>
Signed-off-by: Bin Liu <b-liu@ti.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Heinrich Schuchardt 2018-03-29 10:48:28 -05:00 • committed by Greg Kroah-Hartman
commit 334d8f201e