[RTEMS Project] #4462: CID 1437638: Logically dead code

RTEMS trac trac at rtems.org
Mon Jun 28 23:48:06 UTC 2021


#4462: CID 1437638: Logically dead code
------------------------------+--------------------------
  Reporter:  Harrison Gerber  |      Owner:  Gedare Bloom
      Type:  defect           |     Status:  assigned
  Priority:  normal           |  Milestone:  6.1
 Component:  admin            |    Version:  6
  Severity:  normal           |   Keywords:
Blocked By:                   |   Blocking:
------------------------------+--------------------------
 In rtems-fdt.c:

 The indicated dead code may have performed some action; that action will
 never occur.

 In rtems_fdt_init_index: Code can never be reached because of a logical
 contradiction (CWE-561)


 {{{
 159  entries = calloc(num_entries, sizeof(rtems_fdt_index_entry));
         cond_notnull: Condition entries, taking true branch. Now the value
 of entries is not NULL.
 160  if (!entries)
 161  {
 162    return -RTEMS_FDT_ERR_NO_MEMORY;
 163  }
 164
 165  names = calloc(1, total_name_memory);
         notnull: At condition entries, the value of entries cannot be
 NULL.
         dead_error_condition: The condition !entries cannot be true.
 166  if (!entries)
 167  {

 CID 1437638 (#1 of 1): Logically dead code (DEADCODE)
 dead_error_begin: Execution cannot reach this statement: free(entries);.
 168    free(entries);
 169    return -RTEMS_FDT_ERR_NO_MEMORY;
 170  }
 }}}

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


More information about the bugs mailing list