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: sudarsan N <sudarsansamy2002@gmail.com>
This commit is contained in:
parent
7a80ef3e8b
commit
6efb1b40ce
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user