stm32/mboot: Fix bug with invalid memory access of USB state.
Only one of pcd_fs_handle/pcd_hs_handle is ever initialised, so if both of these USB peripherals are enabled then one of these if-statements will access invalid memory pointed to by an uninitialised Instance. This patch fixes this bug by explicitly referencing the peripheral struct.
This commit is contained in:
parent
5731e535dd
commit
37c4fd3b50
|
@ -1249,12 +1249,12 @@ enter_bootloader:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#if USE_USB_POLLING
|
#if USE_USB_POLLING
|
||||||
#if defined(MICROPY_HW_USB_FS)
|
#if defined(MICROPY_HW_USB_FS)
|
||||||
if (pcd_fs_handle.Instance->GINTSTS & pcd_fs_handle.Instance->GINTMSK) {
|
if (USB_OTG_FS->GINTSTS & USB_OTG_FS->GINTMSK) {
|
||||||
HAL_PCD_IRQHandler(&pcd_fs_handle);
|
HAL_PCD_IRQHandler(&pcd_fs_handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(MICROPY_HW_USB_HS)
|
#if defined(MICROPY_HW_USB_HS)
|
||||||
if (pcd_hs_handle.Instance->GINTSTS & pcd_hs_handle.Instance->GINTMSK) {
|
if (USB_OTG_HS->GINTSTS & USB_OTG_HS->GINTMSK) {
|
||||||
HAL_PCD_IRQHandler(&pcd_hs_handle);
|
HAL_PCD_IRQHandler(&pcd_hs_handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue