Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-37161

Coverity analysis defect 105024: Macro compares unsigned to 0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.4
    • Component/s: Internal Code
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Security 2018-10-08

      Description

      An unsigned value can never be less than 0

      Defect 105024 (STATIC_C)
      Checker NO_EFFECT (subcategory unsigned_compare_macros)
      File: /src/mongo/transport/service_executor_reserved.cpp
      Function mongo::transport::ServiceExecutorReserved::_startWorker()::[lambda() (instance 1)]::operator ()() const::[lambda() (instance 1)]::operator ()() const
      /src/mongo/transport/service_executor_reserved.cpp, line: 90
      This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "this->__coverity_captured_this->_numRunningWorkerThreads.subtractAndFetch(1U) >= 0U".

                      invariant(_numRunningWorkerThreads.subtractAndFetch(1) >= 0);

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: