usb: usb_dc_kinetis: Fix access wrong memory
Add appropriate check. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
08f53a435c
commit
40774007c3
1 changed files with 5 additions and 0 deletions
|
@ -799,6 +799,11 @@ int usb_dc_ep_mps(const u8_t ep)
|
|||
{
|
||||
u8_t ep_idx = EP_ADDR2IDX(ep);
|
||||
|
||||
if (ep_idx > (NUM_OF_EP_MAX - 1)) {
|
||||
LOG_ERR("Wrong endpoint index/address");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ep & USB_EP_DIR_IN) {
|
||||
return dev_data.ep_ctrl[ep_idx].mps_in;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue