AP_HAL_ChibiOS: fix infinite loop for large SPI transfers

len is 32 bits; i may integer-wrap back to zero at 65535+1
This commit is contained in:
Peter Barker 2021-06-10 19:13:34 +10:00 committed by Andrew Tridgell
parent 82c6d37a59
commit 5c9467044b
1 changed files with 1 additions and 1 deletions

View File

@ -179,7 +179,7 @@ bool SPIDevice::do_transfer(const uint8_t *send, uint8_t *recv, uint32_t len)
bool ret = true;
#if defined(HAL_SPI_USE_POLLED)
for (uint16_t i=0; i<len; i++) {
for (uint32_t i=0; i<len; i++) {
uint8_t ret = spiPolledExchange(spi_devices[device_desc.bus].driver, send?send[i]:0);
if (recv) {
recv[i] = ret;