summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-07-16 11:06:01 +0800
committerGitHub <[email protected]>2018-07-16 11:06:01 +0800
commitadd3eedeea382c3cfdaf80a368ce518a19489c3f (patch)
tree04d2a4779d9b548b559f6fe4268131b3ba52a7de /components
parent18bf09808724bc4074ffa6e8147467a32adccb67 (diff)
parentdc0aa39b429a925bddcb30b05984c821a3306308 (diff)
Merge pull request #1631 from Bluebear233/patch-4
[DeviceDriver][serial] 修复get_index越界问题
Diffstat (limited to 'components')
-rw-r--r--components/drivers/serial/serial.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c
index 34f8f621e7..f94b7eda01 100644
--- a/components/drivers/serial/serial.c
+++ b/components/drivers/serial/serial.c
@@ -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;
}