Skip to content

Commit 6e0ef1c

Browse files
jsiverskogioannisg
authored andcommitted
drivers: usb: stm32: fix potential null pointer dereference
perform null pointer check before dereferencing. Signed-off-by: Jacob Siverskog <[email protected]>
1 parent 4004665 commit 6e0ef1c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/usb/device/usb_dc_stm32.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,14 +627,14 @@ int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const ep_cfg)
627627
uint8_t ep = ep_cfg->ep_addr;
628628
struct usb_dc_stm32_ep_state *ep_state = usb_dc_stm32_get_ep_state(ep);
629629

630-
LOG_DBG("ep 0x%02x, previous ep_mps %u, ep_mps %u, ep_type %u",
631-
ep_cfg->ep_addr, ep_state->ep_mps, ep_cfg->ep_mps,
632-
ep_cfg->ep_type);
633-
634630
if (!ep_state) {
635631
return -EINVAL;
636632
}
637633

634+
LOG_DBG("ep 0x%02x, previous ep_mps %u, ep_mps %u, ep_type %u",
635+
ep_cfg->ep_addr, ep_state->ep_mps, ep_cfg->ep_mps,
636+
ep_cfg->ep_type);
637+
638638
#ifdef USB
639639
if (ep_cfg->ep_mps > ep_state->ep_pma_buf_len) {
640640
if (USB_RAM_SIZE <=

0 commit comments

Comments
 (0)