serial: sh-sci: Is there a potential buffer underflow in sci_dma_rx_complete()?
Hello,
Our static analysis tool reports a possible buffer underflow in sh-sci.c in Linux 5.14.0-rc3:
The variable active is checked in:
1304: if (active >= 0)
This indicates that it can be negative.
If so, a possible buffer underflow will occur:
1312: desc = dmaengine_prep_slave_sg(s->chan_rx, &s->sg_rx[active], 1, ....);
However, I am not sure whether &s->sg_rx[active] will be used in dmaengine_prep_slave_sg() if the function sci_dma_rx_find_active() called at Line 1303 returns a negative value (-1).
Any feedback would be appreciated, thanks!
Reported-by TOTE Robot <[email protected]>
Best wishes,
Tuo Li