Skip to content
Permalink
Browse files

usb: usb_dc_kinetis: Verify endpoint is valid

Verify endpoint before usb_dc_ep_set_callback().

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information...
finikorg authored and nashif committed Mar 27, 2019
1 parent 53ab1e2 commit cc9c91513f6e2b56ba14494dd08c279df2d10ea8
Showing with 5 additions and 0 deletions.
  1. +5 −0 drivers/usb/device/usb_dc_kinetis.c
@@ -793,6 +793,11 @@ int usb_dc_ep_set_callback(const u8_t ep, const usb_dc_ep_callback cb)
{
u8_t ep_idx = EP_ADDR2IDX(ep);

if (ep_idx > (NUM_OF_EP_MAX - 1)) {
LOG_ERR("Wrong endpoint index/address");
return -EINVAL;
}

if (!dev_data.attached) {
return -EINVAL;
}

0 comments on commit cc9c915

Please sign in to comment.
You can’t perform that action at this time.