Merge "net: qrtr: haven: Add bounds check in rx path"

This commit is contained in:
qctecmdr 2023-01-08 22:40:00 -08:00 committed by Gerrit - the friendly Code Review server
commit a1531c645a

View File

@ -148,6 +148,9 @@ static void haven_rx_peak(struct haven_pipe *pipe, void *data,
if (tail >= pipe->length) if (tail >= pipe->length)
tail -= pipe->length; tail -= pipe->length;
if (WARN_ON_ONCE(tail > pipe->length))
return;
len = min_t(size_t, count, pipe->length - tail); len = min_t(size_t, count, pipe->length - tail);
if (len) if (len)
memcpy_fromio(data, pipe->fifo + tail, len); memcpy_fromio(data, pipe->fifo + tail, len);