Commit 6efb1b40 authored by sudarsan N's avatar sudarsan N Committed by Daniel DeGrasse
Browse files

drivers: spi_rtio: Fix potential null pointer dereference



Avoid accessing tx_bufs or rx_bufs when they are NULL by adding proper
conditional checks before dereferencing. This addresses Coverity issue

CID 516225 (CWE-476).

Signed-off-by: default avatarsudarsan N <sudarsansamy2002@gmail.com>
parent 7a80ef3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ int spi_rtio_copy(struct rtio *r,
		rx_len = rx_bufs->buffers[rx].len;
	} else {
		rx_buf = NULL;
		rx_len = tx_bufs->buffers[tx].len;
		rx_len = (tx_bufs != NULL && tx < tx_count) ? tx_bufs->buffers[tx].len : 0;
	}