diff --git a/net/qrtr/haven.c b/net/qrtr/haven.c index b37e779c7e7f..c66564c0f00b 100644 --- a/net/qrtr/haven.c +++ b/net/qrtr/haven.c @@ -148,6 +148,9 @@ static void haven_rx_peak(struct haven_pipe *pipe, void *data, 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);