- **status**: assigned --> fixed
- **Comment**:

commit be06c19d6b4dd4b6646f5801d9311d906db021f9 (HEAD -> develop, 
origin/develop, ticket-3374)
Author: tai.h.nguyen <[email protected]>
Date:   Mon Aug 18 09:26:18 2025 +0700

    amf: Fix coding issue identified by codechecker [#3374]




---

**[tickets:#3374] amf: coding issues identified by codechecker**

**Status:** fixed
**Milestone:** 5.25.09
**Created:** Thu May 22, 2025 09:50 AM UTC by Nguyen Huynh Tai
**Last Updated:** Wed Jun 25, 2025 06:34 AM UTC
**Owner:** Nguyen Huynh Tai


~~~
[MEDIUM] /home/opensaf-code/src/amf/amfd/imm.h:109:3: Member variable 
'ImmObjUpdate::value_' is not initialized in the constructor. 
[cppcheck-uninitMemberVar]
  ImmObjUpdate() : ImmJob(){};
  ^
[HIGH] /home/opensaf-code/src/amf/amfd/sg.cc:930:32: Forming reference to null 
pointer [core.NonNullParamChecker]
        SaNameT sg_type_name = *((SaNameT *)value);
                               ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/ndmsg.cc:262:27: missing field 
'i_svc_id' initializer [clang-diagnostic-missing-field-initializers]
  NCSMDS_INFO snd_mds = {0};
                          ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/node.cc:130:11: Member variable 
'AVD_AVND::node_up_msg_count' is not initialized in the constructor. 
[cppcheck-uninitMemberVar]
AVD_AVND::AVD_AVND() { initialize(); }
          ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/node.cc:130:11: Member variable 
'AVD_AVND::reboot' is not initialized in the constructor. 
[cppcheck-uninitMemberVar]
AVD_AVND::AVD_AVND() { initialize(); }
          ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/node.cc:133:11: Member variable 
'AVD_AVND::node_up_msg_count' is not initialized in the constructor. 
[cppcheck-uninitMemberVar]
AVD_AVND::AVD_AVND(const std::string &dn) : name(dn) {
          ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/node.cc:133:11: Member variable 
'AVD_AVND::reboot' is not initialized in the constructor. 
[cppcheck-uninitMemberVar]
AVD_AVND::AVD_AVND(const std::string &dn) : name(dn) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/node.cc:800:26: Uninitialized variable: 
temp_su_prob [cppcheck-uninitvar]
      su_failover_prob = temp_su_prob;
                         ^
[HIGH] /home/opensaf-code/src/amf/amfd/sg_npm_fsm.cc:3810:9: Null pointer 
dereference: su->sg_of_su->si_tobe_redistributed [cppcheck-nullPointer]
        TRACE("SI transfer failed for SI '%s' as max_assigned_su went down",
        ^
[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1801:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1844:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1864:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1883:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1908:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1987:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1997:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2008:11: Uninitialized variable: 
timeout [cppcheck-uninitvar]
      if (timeout == 0) {
          ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2183:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2256:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2279:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2301:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2323:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2361:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2394:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2412:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:2432:31: Uninitialized variable: 
&temp_timeout [cppcheck-uninitvar]
      memcpy(¶m.value[0], &temp_timeout, param.value_len);
                              ^
[LOW] /home/opensaf-code/src/amf/amfd/csiattr.cc:594:9: Value stored to 'i' is 
never read [deadcode.DeadStores]
        i = 1;
        ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/dmsg.cc:152:27: missing field 
'i_svc_id' initializer [clang-diagnostic-missing-field-initializers]
  NCSMDS_INFO snd_mds = {0};
                          ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/mds.cc:104:35: missing field 
'i_svc_id' initializer [clang-diagnostic-missing-field-initializers]
  NCSMDS_INFO svc_to_mds_info = {0};
                                  ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/mds.cc:645:27: missing field 
'i_svc_id' initializer [clang-diagnostic-missing-field-initializers]
  NCSMDS_INFO snd_mds = {0};
                          ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:2126:27: missing field 
'i_svc_id' initializer [clang-diagnostic-missing-field-initializers]
  NCSMDS_INFO snd_mds = {0};
                          ^
[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1898:19: Access to field 'su' 
results in a dereference of a null pointer (loaded from variable 'comp') 
[core.NullDereference]
      if (true == comp->su->su_is_external) {
                  ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1914:19: Access to field 'su' 
results in a dereference of a null pointer (loaded from variable 'comp') 
[core.NullDereference]
      if (true == comp->su->su_is_external) {
                  ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1923:19: Access to field 'su' 
results in a dereference of a null pointer (loaded from variable 'comp') 
[core.NullDereference]
      if (true == comp->su->su_is_external) {
                  ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1940:19: Access to field 'su' 
results in a dereference of a null pointer (loaded from variable 'comp') 
[core.NullDereference]
      if (true == comp->su->su_is_external) {
                  ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1954:19: Access to field 'su' 
results in a dereference of a null pointer (loaded from variable 'comp') 
[core.NullDereference]
      if (true == comp->su->su_is_external) {
                  ^

[HIGH] /home/opensaf-code/src/amf/amfd/comp.cc:1970:19: Access to field 'su' 
results in a dereference of a null pointer (loaded from variable 'comp') 
[core.NullDereference]
      if (true == comp->su->su_is_external) {
                  ^
[MEDIUM] /home/opensaf-code/src/amf/amfd/hlt.cc:167:29: missing field 'attr_id' 
initializer [clang-diagnostic-missing-field-initializers]
  AVSV_PARAM_INFO param = {0};
                            ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1367:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  synced_reo_type: %d\n", avd_cb->synced_reo_type);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1368:3: %llu in format string 
(no. 1) requires 'unsigned long long' but the argument type is 'signed long 
long'. [cppcheck-invalidPrintfArgType_uint]
  fprintf(f, "  cluster_init_time: %llu\n", avd_cb->cluster_init_time);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1373:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  cb_updt:%d\n", avd_cb->async_updt_cnt.cb_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1374:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  node_updt:%d\n", avd_cb->async_updt_cnt.node_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1375:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  app_updt:%d\n", avd_cb->async_updt_cnt.app_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1376:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  sg_updt:%d\n", avd_cb->async_updt_cnt.sg_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1377:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  su_updt:%d\n", avd_cb->async_updt_cnt.su_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1378:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  si_updt:%d\n", avd_cb->async_updt_cnt.si_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1379:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  sg_su_oprlist_updt:%d\n",
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1381:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  sg_admin_si_updt:%d\n",
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1383:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  siass_updt:%d\n", avd_cb->async_updt_cnt.siass_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1384:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  comp_updt:%d\n", avd_cb->async_updt_cnt.comp_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1385:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  csi_updt:%d\n", avd_cb->async_updt_cnt.csi_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1386:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  compcstype_updt:%d\n", avd_cb->async_updt_cnt.compcstype_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1387:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  si_trans_updt:%d\n", avd_cb->async_updt_cnt.si_trans_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1388:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  ng_updt:%d\n", avd_cb->async_updt_cnt.ng_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1389:3: %d in format string 
(no. 1) requires 'int' but the argument type is 'unsigned int'. 
[cppcheck-invalidPrintfArgType_sint]
  fprintf(f, "  failover_updt:%d\n", avd_cb->async_updt_cnt.failover_updt);
  ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1399:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'AVD_AVND_STATE {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    node_state: %u\n", node->node_state);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1431:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'SaToggleState {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    si_switch: %u\n", si->si_switch);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1432:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'AVD_SI_DEP_STATE {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    si_dep_state: %u\n", si->si_dep_state);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1439:7: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'AVD_SU_SI_STATE {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
      fprintf(f, "        fsm: %u\n", susi->fsm);
      ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1474:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'SaAdjustState {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    adjust_state: %u\n", sg->adjust_state);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1475:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'AVD_SG_FSM_STATE {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    sg_fsm_state: %u\n", sg->sg_fsm_state);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1482:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'SaBoolT {aka signed 
int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    saAmfSUPreInstantiable: %u\n", su->saAmfSUPreInstantiable);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1499:5: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'SaToggleState {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(f, "    su_switch: %u\n", su->su_switch);
    ^

[MEDIUM] /home/opensaf-code/src/amf/amfd/util.cc:1504:7: %u in format string 
(no. 1) requires 'unsigned int' but the argument type is 'AVD_SU_SI_STATE {aka 
signed int}'. [cppcheck-invalidPrintfArgType_uint]
      fprintf(f, "      fsm: %u\n", susi->fsm);
      ^

~~~


---

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

Reply via email to