- **summary**: smfd: coding issues identified by codechecker --> imm: coding 
issues identified by codechecker



---

**[tickets:#3376] imm: coding issues identified by codechecker**

**Status:** accepted
**Milestone:** 5.25.09
**Created:** Fri May 30, 2025 10:47 AM UTC by Thien Minh Huynh
**Last Updated:** Fri May 30, 2025 10:47 AM UTC
**Owner:** Thien Minh Huynh


~~~
[HIGH] /home/ubuntu/opensaf-code/src/imm/agent/imma_om_api.cc:7735:9: 
Dereference of null pointer [core.NullDereference]
    if (searchParam->searchOneAttr.attrValue) { /*free-3 */
        ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_admin.c:214:3: %llu in 
format string (no. 3) requires 'unsigned long long' but the argument type is 
'signed long long'. [cppcheck-invalidPrintfArgType_uint]
    printf("%-50s %-12s %llu (0x%llx, %s)\n", param->paramName,
    ^

[HIGH] /home/ubuntu/opensaf-code/src/imm/tools/imm_admin.c:340:4: Common 
realloc mistake: 'params' nulled but not freed upon failure 
[cppcheck-memleakOnRealloc]
      params = realloc(
      ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/apitest/implementer/applier.c:216:3: 
%u in format string (no. 1) requires 'unsigned int' but the argument type is 
'signed int'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(stderr, "Reply on admin operation failed, err:%u\n",
    ^
[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_list.c:445:19: comparison 
of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned int') 
[clang-diagnostic-sign-compare]
        for (j = 0; j < attr->attrValuesNumber; j++) {
                      ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_list.c:448:18: comparison 
of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned int') 
[clang-diagnostic-sign-compare]
          if ((j + 1) < attr->attrValuesNumber)
                      ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_list.c:459:19: comparison 
of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned int') 
[clang-diagnostic-sign-compare]
        for (j = 0; j < attr->attrValuesNumber; j++) {
                      ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_list.c:463:18: comparison 
of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned int') 
[clang-diagnostic-sign-compare]
          if ((j + 1) < attr->attrValuesNumber)
                      ^
[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_cfg.c:249:17: comparison 
of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned int') 
[clang-diagnostic-sign-compare]
    for (i = 0; i < attrValues->attrValuesNumber; i++)
                  ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_cfg.c:264:17: comparison 
of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned int') 
[clang-diagnostic-sign-compare]
    for (i = 0; i < attrMod->modAttr.attrValuesNumber; i++) {
                  ^

[HIGH] /home/ubuntu/opensaf-code/src/imm/immnd/ImmModel.cc:5405:32: Forming 
reference to null pointer [core.NonNullParamChecker]
              if (!release && (adm->mAdminOwnerName == oldOwner)) {
                               ^

[HIGH] /home/ubuntu/opensaf-code/src/imm/immnd/ImmModel.cc:5450:41: Forming 
reference to null pointer [core.NonNullParamChecker]
                        if (!release && adm->mAdminOwnerName == oldOwner) {
                                        ^

[HIGH] /home/ubuntu/opensaf-code/src/imm/immnd/ImmModel.cc:8975:21: Dereference 
of null pointer [core.NullDereference]
      if (!(strnlen(t->n.attrName.buf, t->n.attrName.size) == rdnAttrLen) ||
                    ^
[MEDIUM] /home/ubuntu/opensaf-code/src/imm/immloadd/imm_pbe_load.cc:257:5: %u 
in format string (no. 1) requires 'unsigned int' but the argument type is 
'signed int'. [cppcheck-invalidPrintfArgTyp
e_uint]
    snprintf(buf, 32, "Row(%u): <", ++r);
    ^
[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_list.c:106:3: %llu in 
format string (no. 1) requires 'unsigned long long' but the argument type is 
'signed long long'. [cppcheck-invalidPrintf
ArgType_uint]
    printf("%llu", *((SaTimeT *)attrValue));
    ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/tools/imm_list.c:171:3: %llu in 
format string (no. 1) requires 'unsigned long long' but the argument type is 
'signed long long'. [cppcheck-invalidPrintf
ArgType_uint]
    printf("%llu (0x%llx, %s)", *((SaTimeT *)attrValue),
    ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/apitest/management/populate.c:174:3: 
%u in format string (no. 2) requires 'unsigned int' but the argument type is 
'signed int'. [cppcheck-invalidPrintfArgType_uint]
    fprintf(stderr,
    ^

[MEDIUM] /home/ubuntu/opensaf-code/src/imm/immnd/immnd_evt.c:4722:15: 
comparison of integers of different signs: 'int' and 'SaUint32T' (aka 'unsigned 
int') [clang-diagnostic-sign-compare]
        for (; ix < applArrSize && err == SA_AIS_OK;
                  ^


~~~


---

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