serial: uart_async_rx: Avoid possible division by zero
Ensures that config->but_cnt is not zero. Fixes #66800 CID #338107 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
08e44f9dae
commit
5822267c23
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue