RTEMS | TMS570: tms570_sci_set_attributes has no protection against 0 baud rate (#5555)

Avi Weiss (@thnkslprpt) gitlab at rtems.org
Wed Apr 22 08:31:40 UTC 2026



Avi Weiss created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5555



## Summary
<!--
-->
`tms570_sci_set_attributes` has no protection against `0` baud rate  

`rtems_termios_baud_to_number` documentation shows it can `return 0`  

Can result in divide by zero inside `tms570_sci_set_attributes` in at least one or two locations (and then also `tms570_sci_interrupt_last_close`).  

## Steps to reproduce
Code review.  
Snippets from `tms570_sci_set_attributes` where we can end up with divide-by-zero:
```c
...
    tw = tw * 5 / baudrate + 1;
...
  bauddiv = (TMS570_VCLK_HZ + baudrate / 2) / baudrate;
...
```

## Expected behaviour

<!--
-->
Need at a minimum simple check to reject `0` and fail early to not flow it through to the calculation steps.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5555
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260422/d3d9172d/attachment.htm>


More information about the bugs mailing list