Fix possible null ptr dereference (#670)

This commit is contained in:
Igor 2021-06-18 20:10:44 -07:00 committed by GitHub
parent eccafa3712
commit 4c57ebd928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -420,14 +420,12 @@ void USB_WritePacket(const void *src, uint16_t len, uint32_t ep) {
USBx_INEP(ep)->DIEPCTL |= (USB_OTG_DIEPCTL_CNAK | USB_OTG_DIEPCTL_EPENA); USBx_INEP(ep)->DIEPCTL |= (USB_OTG_DIEPCTL_CNAK | USB_OTG_DIEPCTL_EPENA);
// load the FIFO // load the FIFO
const uint32_t *src_copy = (const uint32_t *)src; if (src != NULL) {
for (uint32_t i = 0; i < count32b; i++) { const uint32_t *src_copy = (const uint32_t *)src;
// FIXME: for (uint32_t i = 0; i < count32b; i++) {
// cppcheck-suppress nullPointer USBx_DFIFO(ep) = *src_copy;
USBx_DFIFO(ep) = *src_copy; src_copy++;
// FIXME: }
// cppcheck-suppress nullPointerArithmetic
src_copy++;
} }
} }