From 6ed21ee1c0529186dc3e72533a3a6a81fd55eb40 Mon Sep 17 00:00:00 2001 From: Yuan Cao Date: Sat, 13 Jul 2019 00:05:25 -0400 Subject: [PATCH] Fixed serial_device IRQ infinite loop bug due to uint8_t overflowing --- targets/TARGET_STM/TARGET_STM32F0/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32F1/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32F2/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32F3/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32F4/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32F7/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32H7/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32L0/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32L1/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32L4/serial_device.c | 2 +- targets/TARGET_STM/TARGET_STM32WB/serial_device.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32F0/serial_device.c b/targets/TARGET_STM/TARGET_STM32F0/serial_device.c index f6954a2968..5dc1ac9dbc 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32F0/serial_device.c @@ -605,7 +605,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32F1/serial_device.c b/targets/TARGET_STM/TARGET_STM32F1/serial_device.c index 3675668b07..d351e6838c 100644 --- a/targets/TARGET_STM/TARGET_STM32F1/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32F1/serial_device.c @@ -476,7 +476,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32F2/serial_device.c b/targets/TARGET_STM/TARGET_STM32F2/serial_device.c index 9ed602867e..4853f3d825 100644 --- a/targets/TARGET_STM/TARGET_STM32F2/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32F2/serial_device.c @@ -559,7 +559,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32F3/serial_device.c b/targets/TARGET_STM/TARGET_STM32F3/serial_device.c index 81f2c8aa25..a9fa18498d 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32F3/serial_device.c @@ -522,7 +522,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32F4/serial_device.c b/targets/TARGET_STM/TARGET_STM32F4/serial_device.c index 79a76bf689..e2f076641f 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32F4/serial_device.c @@ -604,7 +604,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32F7/serial_device.c b/targets/TARGET_STM/TARGET_STM32F7/serial_device.c index 3668ce7ce1..66ba5c0369 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32F7/serial_device.c @@ -560,7 +560,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32H7/serial_device.c b/targets/TARGET_STM/TARGET_STM32H7/serial_device.c index f3f9c7ee9d..c9eeb4e37a 100644 --- a/targets/TARGET_STM/TARGET_STM32H7/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32H7/serial_device.c @@ -573,7 +573,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32L0/serial_device.c b/targets/TARGET_STM/TARGET_STM32L0/serial_device.c index 012fcebe5a..d57bb96804 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32L0/serial_device.c @@ -500,7 +500,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32L1/serial_device.c b/targets/TARGET_STM/TARGET_STM32L1/serial_device.c index 3b84db9d63..3b807fc949 100644 --- a/targets/TARGET_STM/TARGET_STM32L1/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32L1/serial_device.c @@ -512,7 +512,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32L4/serial_device.c b/targets/TARGET_STM/TARGET_STM32L4/serial_device.c index 1e5d505a77..bb1bc5e4de 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32L4/serial_device.c @@ -536,7 +536,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) { diff --git a/targets/TARGET_STM/TARGET_STM32WB/serial_device.c b/targets/TARGET_STM/TARGET_STM32WB/serial_device.c index c0262aac1f..2e9ec5df51 100644 --- a/targets/TARGET_STM/TARGET_STM32WB/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32WB/serial_device.c @@ -461,7 +461,7 @@ int serial_irq_handler_asynch(serial_t *obj) volatile int return_event = 0; uint8_t *buf = (uint8_t *)(obj->rx_buff.buffer); - uint8_t i = 0; + size_t i = 0; // TX PART: if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TC) != RESET) {