Changeset 9344677 in rtems


Ignore:
Timestamp:
May 21, 2013, 1:58:12 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
db0cede1
Parents:
9984acd
git-author:
Sebastian Huber <sebastian.huber@…> (05/21/13 13:58:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/27/13 10:49:14)
Message:

bsp/qoriq: Avoid NULL pointer access

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/qoriq/console/console-config.c

    r9984acd r9344677  
    188188static void output_char(char c)
    189189{
    190   const console_fns *con = Console_Port_Tbl [Console_Port_Minor]->pDeviceFns;
    191  
    192   if (c == '\n') {
    193     con->deviceWritePolled((int) Console_Port_Minor, '\r');
     190  int minor = (int) Console_Port_Minor;
     191  const console_tbl **ct_tbl = Console_Port_Tbl;
     192
     193  if (ct_tbl != NULL) {
     194    const console_fns *cf = ct_tbl[minor]->pDeviceFns;
     195
     196    if (c == '\n') {
     197      (*cf->deviceWritePolled)(minor, '\r');
     198    }
     199
     200    (*cf->deviceWritePolled)(minor, c);
    194201  }
    195   con->deviceWritePolled((int) Console_Port_Minor, c);
    196202}
    197203
Note: See TracChangeset for help on using the changeset viewer.