[lvc-project] [PATCH v2] serial: 8250_mtk: correct max baud rate in set_termios() method
Fedor Pchelkin
pchelkin at ispras.ru
Sat Oct 18 15:57:23 MSK 2025
On Sun, 12. Oct 20:56, Sergey Shtylyov wrote:
> Mediatek MT798x datasheets (that I was able to get my hands on) claim
> the maximum supported baud rate to be 3 Mbps, while commit 81bb549fdf14
> ("serial: 8250_mtk: support big baud rate.") claimed it to be 4 Mbps --
> however, it then passed undivided port->uartclk to uart_get_baud_rate()
> for the maximum baud rate, while the datasheets do mention up to 52 MHz
> as the baud clock's frequency. This means that an integer overflow will
> happen (when multiplying the baud variable by 256) if a baud rate higher
> than 16777215 bps is passed via termios->c_ospeed. Pass the correct max
> baud rate of 3 Mbps or port->uartclk, whichever happens to be less...
Кажется, на эту проблему уже ушло больше времени, чем она того заслуживает.
Добавлю патч с корректировкой на 4 Mbps в описании и diff'е.
>
> 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 at omp.ru>
More information about the lvc-project
mailing list