mirror of https://github.com/commaai/panda.git
Fix possible null ptr dereference (#670)
This commit is contained in:
parent
eccafa3712
commit
4c57ebd928
|
@ -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++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue