Skip to content

Commit

Permalink
serial: uart_async_rx: Avoid possible division by zero
Browse files Browse the repository at this point in the history
Ensures that config->but_cnt is not zero.

Fixes #66800
CID #338107

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
(cherry picked from commit 5822267)
  • Loading branch information
Flavio Ceolin authored and nashif committed Sep 17, 2024
1 parent 2b4e327 commit 062d4d5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/serial/uart_async_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void uart_async_rx_reset(struct uart_async_rx *rx_data)
int uart_async_rx_init(struct uart_async_rx *rx_data,
const struct uart_async_rx_config *config)
{
__ASSERT_NO_MSG(config->buf_cnt > 0);
__ASSERT_NO_MSG(config->length / config->buf_cnt <= UINT8_MAX);
memset(rx_data, 0, sizeof(*rx_data));
rx_data->config = config;
Expand Down

0 comments on commit 062d4d5

Please sign in to comment.