Menu

#3369 smfd: coding issues identified by codechecker

5.26.02
fixed
None
defect
smf
d
major
False
2026-02-27
2025-04-16
No
[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:2677:3: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [cppcheck-invalidPrintfArgType_sint]
  snprintf(str, strSize, "%d", i_step->getMaxRetry());
  ^

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:2684:3: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [cppcheck-invalidPrintfArgType_sint]
  snprintf(str, strSize, "%d", i_step->getRetryCount());
  ^

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:2691:3: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [cppcheck-invalidPrintfArgType_sint]
  snprintf(str, strSize, "%d", i_step->getRestartOption());
  ^

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfCampState.cc:378:36: Comparison of a boolean expression with an integer. [cppcheck-compareBoolExpressionWithInt]
  if (i_camp->m_campInit.execute() != SA_AIS_OK) {
                                   ^

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfCampState.cc:1850:37: Comparison of a boolean expression with an integer. [cppcheck-compareBoolExpressionWithInt]
  if (i_camp->m_campInit.rollback() != SA_AIS_OK) {

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:3748:54: unused variable 'proc_iter' [clang-diagnostic-unused-variable]
  std::vector<SmfUpgradeProcedure *>::const_iterator proc_iter;
                                                     ^

[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:4192:10: variable 'instanceCtDefDisableRestart' may be uninitialized when used here [clang-diagnostic-conditional-uninitialized]
        (instanceCtDefDisableRestart ==
         ^

[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:4200:14: variable 'instanceCompDisableRestart' may be uninitialized when used here [clang-diagnostic-conditional-uninitialized]
  } else if (instanceCompDisableRestart ==
             ^
[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:1277:7: Called C++ object pointer is null [core.CallAndMessage]
      (*actionElem).changeId(initActionId);
      ^

[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:1291:7: Called C++ object pointer is null [core.CallAndMessage]
      (*actionElem).changeId(wrapupActionId);
      ^
[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:3359:5: Potential leak of memory pointed to by 'newStep' [cplusplus.NewDeleteLeaks]
    LOG_NO(
    ^

[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:3412:5: Use of memory after it is freed [cplusplus.NewDelete]
    addProcStep(newStep);
    ^

[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:3464:9: Called C++ object pointer is null [core.CallAndMessage]
        (*actioniter).changeId(initActionId);
        ^

[HIGH] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeProcedure.cc:3483:9: Called C++ object pointer is null [core.CallAndMessage]
        (actioniter)->changeId(wrapupActionId);
        ^
[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeCampaign.cc:476:5: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [cppcheck-invalidPrintfArgType_uint]
    snprintf(buf, 4, "%u", curCnt);
    ^
[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeCampaign.cc:1038:12: expression is redundant [misc-redundant-expression]
    if (rc != SA_AIS_OK && rc == SA_AIS_ERR_TRY_AGAIN) {
           ^
[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfImmOperation.h:138:3: 'const' type qualifier on return type has no effect [clang-diagnostic-ignored-qualifiers]
  const OperationType GetOperationType() { return imm_operation_; }

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/agent/smfa_utils.c:382:26: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]
            if ((hdl_list->hdl ==
                               ^

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/agent/smfa_utils.c:420:24: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]
  if ((cbk_list->inv_id == cbk_prev->inv_id)) {
                        ^

[MEDIUM] /home/ubuntu/opensaf-code/src/smf/agent/smfa_utils.c:482:24: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]
  if ((cbk_list->inv_id == cbk_prev->inv_id)) {
                        ^

Related

Wiki: ChangeLog-5.26.02
Commit: [792b4c]

Discussion

  • Thien Minh Huynh

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -57,5 +57,19 @@
     [MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfUpgradeCampaign.cc:1038:12: expression is redundant [misc-redundant-expression]
         if (rc != SA_AIS_OK &amp;&amp; rc == SA_AIS_ERR_TRY_AGAIN) {
                ^
    +[MEDIUM] /home/ubuntu/opensaf-code/src/smf/smfd/SmfImmOperation.h:138:3: &#39;const&#39; type qualifier on return type has no effect [clang-diagnostic-ignored-qualifiers]
    +  const OperationType GetOperationType() { return imm_operation_; }
    +
    +[MEDIUM] /home/ubuntu/opensaf-code/src/smf/agent/smfa_utils.c:382:26: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]
    +            if ((hdl_list-&gt;hdl ==
    +                               ^
    +
    +[MEDIUM] /home/ubuntu/opensaf-code/src/smf/agent/smfa_utils.c:420:24: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]
    +  if ((cbk_list-&gt;inv_id == cbk_prev-&gt;inv_id)) {
    +                        ^
    +
    +[MEDIUM] /home/ubuntu/opensaf-code/src/smf/agent/smfa_utils.c:482:24: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]
    +  if ((cbk_list-&gt;inv_id == cbk_prev-&gt;inv_id)) {
    +                        ^
    
     ~~~
    
     
  • Gary Lee

    Gary Lee - 2025-04-25
    • Milestone: 5.25.04 --> 5.25.09
     
  • Thien Minh Huynh

    • status: accepted --> review
     
  • Thien Minh Huynh

    • status: review --> fixed
     
  • Thien Minh Huynh

    commit e831af5e523e6a961c2995dccb669ac51148bb52 (HEAD -> develop, origin/develop, ticket-3369)
    Author: thien.m.huynh thien.m.huynh@endava.com
    Date: Tue May 20 15:26:29 2025 +0700

    smf: fix coding issues identified by codechecker [#3369]
    
     

Log in to post a comment.

MongoDB Logo MongoDB