Re: [PATCH] serial: 8250_mtk: correct max baud rate in the set_termios() method
From: Sergey Shtylyov
Date: Sat Sep 20 2025 - 04:56:47 EST
On 9/5/25 11:07 PM, Sergey Shtylyov wrote:
> As is obvious from the code calculating the divisor in the set_termios()
> method, the Mediatek UART driver uses 256-time oversampling for the high
> baud rates, so passing port->uartclk to uart_get_baud_rate() for the max
> acceptable baud rate makes no sense, we should divide by 256 first (this
Well, I thought again and 256 seems to be an overkill, I should probably
have reverted to division by 16 instead...
> should also prevent overflow when some arbitrary baud rate is passed via
> termios->c_ospeed)...
>
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
>
> Fixes: 81bb549fdf14 ("serial: 8250_mtk: support big baud rate.")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxx>
[...]
MBR, Sergey