laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35083?usp=email ) Change subject: soft_uart: check n_bits against 0 in osmo_soft_uart_tx_ubits() ...................................................................... soft_uart: check n_bits against 0 in osmo_soft_uart_tx_ubits() Currently calling this function with n_ubits == 0 would result in requesting one character from the application (via the .tx_cb()), but not actually transmitting anything. Make it return early. Change-Id: Icbf99a9f2f6fa64dd71a5f37922f9001577c6c97 Related: OS#4396 --- M src/core/soft_uart.c 1 file changed, 18 insertions(+), 0 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/core/soft_uart.c b/src/core/soft_uart.c index e0f0780..4fffaee 100644 --- a/src/core/soft_uart.c +++ b/src/core/soft_uart.c @@ -24,6 +24,7 @@ #include <stdint.h> #include <errno.h> +#include <osmocom/core/utils.h> #include <osmocom/core/timer.h> #include <osmocom/core/soft_uart.h> @@ -286,6 +287,9 @@ size_t n_frame_bits, n_chars; struct msgb *msg = NULL; + if (OSMO_UNLIKELY(n_ubits == 0)) + return -EINVAL; + /* calculate UART frame size for the effective config */ n_frame_bits = 1 + cfg->num_data_bits + cfg->num_stop_bits; if (cfg->parity_mode != OSMO_SUART_PARITY_NONE) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35083?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Icbf99a9f2f6fa64dd71a5f37922f9001577c6c97 Gerrit-Change-Number: 35083 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas@eversberg.eu> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-MessageType: merged