drivers: spi: avoid undefined behavior

Void pointer arithmetic is undefined behavior (UB).

It's OK for struct spi_buf to contain a void *, because those values
are only ever stored, read, and compared. However, pointer arithmetic
is done on the tx_buf and rx_buf fields in struct spi_context, so
those need to be u8_t * to avoid UB.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This commit is contained in:
Marti Bolivar 2017-07-17 10:50:18 -04:00 committed by Anas Nashif
commit ec3aece97c

View file

@ -34,9 +34,9 @@ struct spi_context {
struct spi_buf *current_rx; struct spi_buf *current_rx;
size_t rx_count; size_t rx_count;
void *tx_buf; u8_t *tx_buf;
size_t tx_len; size_t tx_len;
void *rx_buf; u8_t *rx_buf;
size_t rx_len; size_t rx_len;
}; };