Changeset 02958c5e in rtems for c/src/libchip/serial/ns16550.c


Ignore:
Timestamp:
Nov 19, 2014, 8:28:08 PM (6 years ago)
Author:
Josh Oguin <josh.oguin@…>
Branches:
4.11, 5, master
Children:
aed6e1d
Parents:
0ad1e80
git-author:
Josh Oguin <josh.oguin@…> (11/19/14 20:28:08)
git-committer:
Joel Sherrill <joel.sherrill@…> (11/26/14 13:51:57)
Message:

libchip/serial/ns16550* and z8530*: Assert on baud number to avoid divide by 0

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/libchip/serial/ns16550.c

    r0ad1e80 r02958c5e  
    533533  /*
    534534   *  Calculate the baud rate divisor
     535   *
     536   *  Assert ensures there is no division by 0.
    535537   */
    536538
    537539  baud_requested = rtems_termios_baud_to_number(t->c_cflag);
     540  _Assert( baud_requested != 0 );
    538541  ulBaudDivisor = NS16550_GetBaudDivisor(c, baud_requested);
    539542
Note: See TracChangeset for help on using the changeset viewer.