[PATCH] serial: icom: fix off-by-one in baud rate table lookup

From: Hugo Villeneuve

Date: Wed Dec 02 2026 - 11:57:30 EST


The lookup loop only test indices 0 to BAUD_TABLE_LIMIT - 1, leaving the
last entry 460800 unreachable. Requesting exactly that rate always falls
through with new_config3 left at its initializer 0, silently programming
the hardware for 300 baud instead.

Fix the loop bound to include the last table entry.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Hugo Villeneuve <hugo@xxxxxxxxxxx>
---
drivers/tty/serial/icom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index b6399d86a0bc3..e594fc6b655f5 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -1397,7 +1397,7 @@ static void icom_set_termios(struct uart_port *port, struct ktermios *termios,
icom_acfg_baud[0],
icom_acfg_baud[BAUD_TABLE_LIMIT]);

- for (index = 0; index < BAUD_TABLE_LIMIT; index++) {
+ for (index = 0; index <= BAUD_TABLE_LIMIT; index++) {
if (icom_acfg_baud[index] == baud) {
new_config3 = index;
break;

base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.47.3