Peter Maydell <peter.mayd...@linaro.org> writes:

> In commit b88cfee90268cad we defined masks for the IBRD and FBRD
> integer and fractional baud rate divider registers, to prevent the
> guest from writing invalid values which could cause division-by-zero.
> Unfortunately we got the mask values the wrong way around: the FBRD
> register is six bits and the IBRD register is 16 bits, not
> vice-versa.
>
> You would only run into this bug if you programmed the UART to a baud
> rate of less than 9600, because for 9600 baud and above the IBRD
> value will fit into 6 bits, as per the table in
>  
> https://developer.arm.com/documentation/ddi0183/g/programmers-model/register-descriptions/fractional-baud-rate-register--uartfbrd
>
> The only visible effects would be that the value read back from
> the register by the guest would be truncated, and we would
> print an incorrect baud rate in the debug logs.
>
> Cc: qemu-sta...@nongnu.org
> Fixes: b88cfee90268 ("hw/char/pl011: Avoid division-by-zero in 
> pl011_get_baudrate()")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2610
> Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>

Reviewed-by: Alex Bennée <alex.ben...@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to