[RTEMS Project] #4416: rtems-exeinfo.cpp: Division or modulo by zero errors spotted by Coverity

RTEMS trac trac at rtems.org
Mon May 17 15:29:32 UTC 2021


#4416: rtems-exeinfo.cpp: Division or modulo by zero errors spotted by Coverity
------------------------+--------------------
  Reporter:  Ryan Long  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  normal     |  Milestone:  6.1
 Component:  tool       |    Version:  6
  Severity:  normal     |   Keywords:
Blocked By:             |   Blocking:
------------------------+--------------------
 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;
 }}}

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


More information about the bugs mailing list