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);
|
||||
|
||||
// load the FIFO
|
||||
const uint32_t *src_copy = (const uint32_t *)src;
|
||||
for (uint32_t i = 0; i < count32b; i++) {
|
||||
// FIXME:
|
||||
// cppcheck-suppress nullPointer
|
||||
USBx_DFIFO(ep) = *src_copy;
|
||||
// FIXME:
|
||||
// cppcheck-suppress nullPointerArithmetic
|
||||
src_copy++;
|
||||
if (src != NULL) {
|
||||
const uint32_t *src_copy = (const uint32_t *)src;
|
||||
for (uint32_t i = 0; i < count32b; i++) {
|
||||
USBx_DFIFO(ep) = *src_copy;
|
||||
src_copy++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue