Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#4241 closed defect (fixed)

rtems-debugger-threads.c: Three Dereference before null check errors spotted by Coverity

Reported by: Ryan Long Owned by: Chris Johns
Priority: normal Milestone: 6.1
Component: lib/debugger Version: 6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

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) {

Change History (1)

comment:1 Changed on 02/12/21 at 23:13:56 by Ryan Long <ryan.long@…>

Resolution: fixed
Status: newclosed

In [changeset:"f65d3384dd923c9ead9bcf264592bd879054f6dc/rtems" f65d3384/rtems]:

rtems-debugger-threads.c: Fix three Dereference before null check errors

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().

Closes #4241.

Note: See TracTickets for help on using tickets.