Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: icom: fix off-by-one in baud rate table lookup
@ 2026-12-02 16:56 Hugo Villeneuve
  2026-12-02 17:00 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Hugo Villeneuve @ 2026-12-02 16:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Hugo Villeneuve, stable, linux-kernel, linux-serial

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@vger.kernel.org
Signed-off-by: Hugo Villeneuve <hugo@hugovil.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 16:56 [PATCH] serial: icom: fix off-by-one in baud rate table lookup Hugo Villeneuve
2026-12-02 17:00 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox