Merge pull request #1631 from Bluebear233/patch-4

[DeviceDriver][serial] 修复get_index越界问题
This commit is contained in:
Bernard Xiong 2018-07-16 11:06:01 +08:00 committed by GitHub
commit add3eedeea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -393,7 +393,7 @@ static void rt_dma_recv_update_get_index(struct rt_serial_device *serial, rt_siz
if (rx_fifo->is_full && len != 0) rx_fifo->is_full = RT_FALSE; if (rx_fifo->is_full && len != 0) rx_fifo->is_full = RT_FALSE;
rx_fifo->get_index += len; rx_fifo->get_index += len;
if (rx_fifo->get_index > serial->config.bufsz) if (rx_fifo->get_index >= serial->config.bufsz)
{ {
rx_fifo->get_index %= serial->config.bufsz; rx_fifo->get_index %= serial->config.bufsz;
} }