[RTEMS Project] #4254: shell.c: Dereference before null check error spotted by Coverity

RTEMS trac trac at rtems.org
Tue Feb 16 21:00:54 UTC 2021


#4254: shell.c: Dereference before null check error spotted by Coverity
------------------------+--------------------
  Reporter:  Ryan Long  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  normal     |  Milestone:  6.1
 Component:  lib        |    Version:  6
  Severity:  normal     |   Keywords:
Blocked By:             |   Blocking:
------------------------+--------------------
 CID 1467420: Dereference before null check in rtems_shell_line_editor().

 {{{
 322  int          in_fileno = fileno(in);
    deref_ptr_in_call: Dereferencing pointer out.
 323  int          out_fileno = fileno(out);
 324
 325  /*
 326   * Only this task can use this file descriptor because calling
 327   * fileno will block if another thread call made a call on this
 328   * descriptor.
 329   */
    CID 1467420 (#1 of 1): Dereference before null check
 (REVERSE_INULL)check_after_deref: Null-checking out suggests that it may
 be null, but it has already been dereferenced on all paths leading to the
 check.
 330  output = (out && isatty(in_fileno));
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/4254>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list