On November 26, 2014 9:33:57 AM CST, Gedare Bloom <ged...@rtems.org> wrote: >On Wed, Nov 26, 2014 at 2:36 AM, Chris Johns <chr...@rtems.org> wrote: >> >> On 26/11/2014 10:02 am, Joel Sherrill wrote: >>> >>> From: Josh Oguin <josh.og...@oarcorp.com> >>> >>> This was flagged by CodeSonar. It should be impossible to get an >>> incorrect baud number back but ensure this in debug mode. The >_Assert() >>> keeps their scanner from evaluating for divide by 0 past this point. >>> --- >>> c/src/libchip/serial/ns16550-context.c | 4 ++++ >>> c/src/libchip/serial/ns16550.c | 3 +++ >>> c/src/libchip/serial/z85c30.c | 8 +++++++- >>> 3 files changed, 14 insertions(+), 1 deletion(-) >>> >>> diff --git a/c/src/libchip/serial/ns16550-context.c >>> b/c/src/libchip/serial/ns16550-context.c >>> index 00ad89c..087627a 100644 >>> --- a/c/src/libchip/serial/ns16550-context.c >>> +++ b/c/src/libchip/serial/ns16550-context.c >>> @@ -592,9 +592,13 @@ static bool ns16550_set_attributes( >>> >>> /* >>> * Calculate the baud rate divisor >>> + * >>> + * Assert ensures there is no division by 0. >>> */ >>> >>> baud_requested = rtems_termios_baud_to_number(t->c_cflag); >>> + _Assert( baud_requested != 0 ); >>> + >> >> >> Should this return an error or the value should be tested in an upper >layer. >> I will raise a ticket to have the upper layers reject B0 as a baud >rate. >> >Good point.
See the other thread. We have to support this in termios but not in drivers. >> Chris >> >> _______________________________________________ >> devel mailing list >> devel@rtems.org >> http://lists.rtems.org/mailman/listinfo/devel >_______________________________________________ >devel mailing list >devel@rtems.org >http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel