usb: usb_dc_stm32: Fix reading invalid EP
Fix crash when reading invalid endpoint found in harness test. Fixes #13560 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
06ef0ca0fc
commit
8ed215e011
1 changed files with 8 additions and 1 deletions
|
@ -782,7 +782,14 @@ int usb_dc_ep_read_wait(u8_t ep, u8_t *data, u32_t max_data_len,
|
||||||
u32_t *read_bytes)
|
u32_t *read_bytes)
|
||||||
{
|
{
|
||||||
struct usb_dc_stm32_ep_state *ep_state = usb_dc_stm32_get_ep_state(ep);
|
struct usb_dc_stm32_ep_state *ep_state = usb_dc_stm32_get_ep_state(ep);
|
||||||
u32_t read_count = ep_state->read_count;
|
u32_t read_count;
|
||||||
|
|
||||||
|
if (!ep_state) {
|
||||||
|
LOG_ERR("Invalid Endpoint %x", ep);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_count = ep_state->read_count;
|
||||||
|
|
||||||
LOG_DBG("ep 0x%02x, %u bytes, %u+%u, %p", ep, max_data_len,
|
LOG_DBG("ep 0x%02x, %u bytes, %u+%u, %p", ep, max_data_len,
|
||||||
ep_state->read_offset, read_count, data);
|
ep_state->read_offset, read_count, data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue