4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-21 00:27:19 +08:00

[DeviceDriver][serial] 修复get_index越界问题

This commit is contained in:
Bluebear233 2018-07-16 09:47:36 +08:00 committed by GitHub
parent 18bf098087
commit dc0aa39b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
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;
}