[RTEMS Project] #4242: rtems-debugger-threads.c: Three Dereference before null check errors spotted by Coverity

RTEMS trac trac at rtems.org
Fri Feb 12 21:30:58 UTC 2021


#4242: rtems-debugger-threads.c: Three Dereference before null check errors
spotted by Coverity
---------------------------+-------------------------
  Reporter:  Ryan Long     |      Owner:  Chris Johns
      Type:  defect        |     Status:  new
  Priority:  normal        |  Milestone:  6.1
 Component:  lib/debugger  |    Version:  6
  Severity:  normal        |   Keywords:
Blocked By:                |   Blocking:
---------------------------+-------------------------
 CID 1468681: Dereference before null check in
 rtems_debugger_thread_continue().
 CID 1468690: Dereference before null check in
 rtems_debugger_thread_system_resume().
 CID 1468694: Dereference before null check in
 rtems_debugger_thread_find_index().
 {{{
 430  rtems_debugger_threads* threads = rtems_debugger->threads;
 431  rtems_debugger_thread*  current;
 432  int                     r = 0;
    deref_ptr_in_call: Dereferencing pointer threads. [show details]
 433  current = rtems_debugger_thread_current(threads);
    CID 1468681 (#1 of 1): Dereference before null check
 (REVERSE_INULL)check_after_deref: Null-checking threads suggests that it
 may be null, but it has already been dereferenced on all paths leading to
 the check.
 434  if (threads != NULL && current != NULL) {
 }}}

 {{{
 347  rtems_debugger_threads* threads = rtems_debugger->threads;
 348  rtems_debugger_thread*  current;
 349  int                     r = 0;
    deref_ptr_in_call: Dereferencing pointer threads. [show details]
 350  current = rtems_debugger_thread_current(threads);
    CID 1468690 (#1 of 1): Dereference before null check
 (REVERSE_INULL)check_after_deref: Null-checking threads suggests that it
 may be null, but it has already been dereferenced on all paths leading to
 the check.
 351  if (threads != NULL && current != NULL) {
 }}}

 {{{
 150  rtems_debugger_threads* threads = rtems_debugger->threads;
    deref_ptr_in_call: Dereferencing pointer threads. [show details]
 151  rtems_debugger_thread*  current =
 rtems_debugger_thread_current(threads);
 152  int                     r = -1;
    CID 1468694 (#1 of 1): Dereference before null check
 (REVERSE_INULL)check_after_deref: Null-checking threads suggests that it
 may be null, but it has already been dereferenced on all paths leading to
 the check.
 153  if (threads != NULL) {
 }}}

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


More information about the bugs mailing list