diff --git a/net/qrtr/fifo.c b/net/qrtr/fifo.c index 8947363528ec..d5ccd5d808d5 100644 --- a/net/qrtr/fifo.c +++ b/net/qrtr/fifo.c @@ -90,6 +90,9 @@ static void fifo_rx_peak(struct fifo_pipe *pipe, if (tail >= pipe->length) tail -= pipe->length; + if (WARN_ON_ONCE(tail > pipe->length)) + return; + len = min_t(size_t, count, pipe->length - tail); if (len) memcpy_fromio(data, pipe->fifo + tail, len);