2020-09-23 02:28 AM
USB MSC - use invalid return types in usbd_storage_if.c
=> see stated in the generated comments:
"@retval USBD_OK if all operations are OK else USBD_FAIL"
where USBD_OK = 0, USBD_FAIL = 3 (defined in usbd_def.h)
the functions in usbd_storage_if.c get called in usbd_msc_scsi.c but error/fail is checked by "<0"
e.g.:
if (((USBD_StorageTypeDef *)pdev->pUserData)->Read(lun, hmsc->bot_data,
hmsc->scsi_blk_addr,
(len / hmsc->scsi_blk_size)) < 0)
=> return USBD_FAIL will never trigger the error in usbd_storage_if.c
steps to reproduce:
STM32CubeIDE Version: 1.4.2
FW_Version:
STM32Cube FW_L4 V1.16.0