We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53df799 commit c6de882Copy full SHA for c6de882
src/system.c
@@ -383,8 +383,8 @@ void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
383
struct complete_packet *rx_pkt = (struct complete_packet *)RX_Buffer;
384
385
/* Limit the amount of data copied to prevent buffer overflow. */
386
- if (rx_pkt->header.size > sizeof(rx_pkt_userspace))
387
- rx_pkt->header.size = sizeof(rx_pkt_userspace);
+ if (rx_pkt->header.size > SPI_DMA_BUFFER_SIZE)
+ rx_pkt->header.size = SPI_DMA_BUFFER_SIZE;
388
389
/* The SPI transfer is now complete, copy to userspace memory. */
390
memcpy((void *)rx_pkt_userspace, &(rx_pkt->data), rx_pkt->header.size);
0 commit comments