#4416 closed defect (fixed)

rtems-exeinfo.cpp: Division or modulo by zero errors spotted by Coverity

Reported by: Ryan Long Owned by: Ryan Long <ryan.long@…>
Priority: normal Milestone: 6.1
Component: tool Version: 6
Severity: normal Keywords: Coverity
Cc: Blocked By:
Blocking:

Description

CID 1503008: Division or modulo by zero in output_inlined().

    CID 1503008 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)9. divide_by_zero: In expression funcs_inlined.size() * 100UL / total, division by expression total which may be zero has undefined behavior.
 801      std::cout << "inlined funcs   : " << funcs_inlined.size () << std::endl
 802                << "    total funcs : " << total << std::endl
 803                << " % inline funcs : " << (funcs_inlined.size () * 100) / total << '%'
 804                << std::endl

CID 1503015: Division or modulo by zero in output_inlined().

   CID 1503015 (#1-2 of 2): Division or modulo by zero (DIVIDE_BY_ZERO)18. divide_by_zero: In expression inlined_size * 100UL / total_size, division by expression total_size which may be zero has undefined behavior.
 805                << "     total size : " << total_size << std::endl
 806                << "    inline size : " << inlined_size << std::endl
 807                << "  % inline size : " << (inlined_size * 100) / total_size << '%'
 808                << std::endl;

Change History (2)

comment:1 Changed on 05/18/21 at 15:52:11 by Ryan Long

Keywords: Coverity added

comment:2 Changed on 06/29/21 at 21:01:12 by Ryan Long <ryan.long@…>

Owner: set to Ryan Long <ryan.long@…>
Resolution: fixed
Status: newclosed

In 7d3b8ac/rtems-tools:

rtems-exeinfo.cpp: Fix division by zero errors

CID 1503008: Division or modulo by zero
CID 1503015: Division or modulo by zero

Closes #4416

Note: See TracTickets for help on using tickets.