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>
This commit is contained in:
parent
53ab1e2414
commit
cc9c91513f
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
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) {
|
if (!dev_data.attached) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue