- **status**: review --> fixed
- **Comment**:
commit e831af5e523e6a961c2995dccb669ac51148bb52 (HEAD -> develop,
origin/develop, ticket-3369)
Author: thien.m.huynh <[email protected]>
Date: Tue May 20 15:26:29 2025 +0700
smf: fix coding issues identified by codechecker [#3369]
---
**[tickets:#3369] smfd: coding issues identified by codechecker**
**Status:** fixed
**Milestone:** 5.25.09
**Created:** Wed Apr 16, 2025 05:57 AM UTC by Thien Minh Huynh
**Last Updated:** Tue May 20, 2025 09:06 AM UTC
**Owner:** Thien Minh Huynh
~~~
[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)) {
^
~~~
---
Sent from sourceforge.net because [email protected] is
subscribed to https://sourceforge.net/p/opensaf/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list._______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets