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:
parent
db91163e43
commit
ec3aece97c
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue