Skip to content

Commit bed6ab3

Browse files
Emil-Juhlkartben
authored andcommitted
spi: rtio: fix using rx_bufs entries for tx_buf
Within spi_rtio_copy there'd be a case where the tx_buf pointer would mistakenly get assigned the address of an rx buffer. Specifically this would happen in the case where there are no rx buffers provided, and as such this would lead to pontential nullptr dereferences. Correct the mistake to let tx_buf correctly point to the provided tx buffers. Signed-off-by: Emil Dahl Juhl <[email protected]>
1 parent 827a4f7 commit bed6ab3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi_rtio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ int spi_rtio_copy(struct rtio *r,
255255
NULL);
256256
tx++;
257257
if (tx < tx_count) {
258-
tx_buf = rx_bufs->buffers[rx].buf;
259-
tx_len = rx_bufs->buffers[rx].len;
258+
tx_buf = tx_bufs->buffers[tx].buf;
259+
tx_len = tx_bufs->buffers[tx].len;
260260
} else {
261261
tx_buf = NULL;
262262
tx_len = 0;

0 commit comments

Comments
 (0)