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

#4240 closed defect (fixed)

rtems-debugger-target.c: Dereference before null check 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 1468682: swbreaks is assigned a value dereferenced from target before it has been verified that target is not null.

173  rtems_debugger_target*         target = rtems_debugger->target;
   deref_ptr: Directly dereferencing pointer target.
174  rtems_debugger_target_swbreak* swbreaks = target->swbreaks.block;
175  size_t                         swbreak_size;
176  uint8_t*                       loc = (void*) addr;
177  size_t                         i;
178  int                            r;
179
   CID 1468682 (#1 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking target suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
180  if (target == NULL || swbreaks == NULL || kind != target->breakpoint_size) {
181    errno = EIO;
182    return -1;
183  }

Change History (1)

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

Resolution: fixed
Status: newclosed

In [changeset:"3f4cdd858923fc999ac7d815149af4c62b8e9c6e/rtems" 3f4cdd8/rtems]:

Error: Processor CommitTicketReference failed
/data/trac/repo/rtems.git does not appear to be a Git repository.
Note: See TracTickets for help on using tickets.