osaf/services/saf/amf/amfd/ndfsm.cc        |   4 +++-
 osaf/services/saf/amf/amfd/ndproc.cc       |   5 ++++-
 osaf/services/saf/amf/amfd/node.cc         |  12 ++++++++----
 osaf/services/saf/amf/amfd/nodegroup.cc    |  18 +++++++++++++++---
 osaf/services/saf/amf/amfd/nodeswbundle.cc |   2 +-
 osaf/services/saf/amf/amfd/ntf.cc          |   6 +++---
 6 files changed, 34 insertions(+), 13 deletions(-)


* Unchecked return value (CHECKED_RETURN)
* Dereference null return value (NULL_RETURNS)
* Uninitialized scalar variable (UNINIT)
* Unnecessary header file (HFA)
* Big parameter passed by value (PASS_BY_VALUE)

diff --git a/osaf/services/saf/amf/amfd/ndfsm.cc 
b/osaf/services/saf/amf/amfd/ndfsm.cc
--- a/osaf/services/saf/amf/amfd/ndfsm.cc
+++ b/osaf/services/saf/amf/amfd/ndfsm.cc
@@ -566,7 +566,9 @@
                            (su_ptr->sg_of_su->sg_redundancy_model == 
SA_AMF_NPM_REDUNDANCY_MODEL) ||
                            (su_ptr->sg_of_su->sg_redundancy_model == 
SA_AMF_N_WAY_ACTIVE_REDUNDANCY_MODEL)) {
                                if (AVD_SU_SI_STATE_MODIFY == 
su_ptr->list_of_susi->fsm) {
-                                       avd_snd_susi_msg(cb, su_ptr, 
AVD_SU_SI_REL_NULL, AVSV_SUSI_ACT_MOD, false, NULL);
+                                       if (avd_snd_susi_msg(cb, su_ptr, 
AVD_SU_SI_REL_NULL, AVSV_SUSI_ACT_MOD, false, NULL) != NCSCC_RC_SUCCESS) {
+                                           LOG_ER("%s: avd_snd_susi_msg 
failed, %s", __FUNCTION__, su_ptr->name.value);
+                                       }
                                        continue;
                                }
                        }
diff --git a/osaf/services/saf/amf/amfd/ndproc.cc 
b/osaf/services/saf/amf/amfd/ndproc.cc
--- a/osaf/services/saf/amf/amfd/ndproc.cc
+++ b/osaf/services/saf/amf/amfd/ndproc.cc
@@ -155,7 +155,10 @@
                for (su = node->list_of_ncs_su; su != NULL; su = 
su->avnd_list_su_next) {
                        if ((su->saAmfSUAdminState == SA_AMF_ADMIN_UNLOCKED) ||
                            (su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED)) {
-                               avd_snd_presence_msg(cb, su, false);
+                               if (avd_snd_presence_msg(cb, su, false) != 
NCSCC_RC_SUCCESS) {
+                                       LOG_ER("%s: Failed to send 
Instantiation order of '%s'",
+                                               __FUNCTION__, su->name.value);
+                               }
                        }
                }
 
diff --git a/osaf/services/saf/amf/amfd/node.cc 
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -259,9 +259,9 @@
         ** If called at new active at failover, the object is found in the DB
         ** but needs to get configuration attributes initialized.
         */
-       if (NULL == (node = avd_node_get(dn))) {
-               if ((node = avd_node_new(dn)) == NULL)
-                       goto done;
+       node = avd_node_get(dn);
+       if (node == NULL) {
+               node = avd_node_new(dn);
        } else
                TRACE("already created, refreshing config...");
 
@@ -303,7 +303,7 @@
        rc = 0;
 
 done:
-       if (rc != 0) {
+       if (rc != 0 && node != NULL) {
                avd_node_delete(node);
                node = NULL;
        }
@@ -437,6 +437,9 @@
        CcbUtilOperationData_t *t_opData;
 
        TRACE_ENTER2("'%s'", opdata->objectName.value);
+       
+       // node must not be NULL
+       osafassert(node);
 
        if (node->node_info.member) {
                report_ccb_validation_error(opdata, "Node '%s' is still cluster 
member", opdata->objectName.value);
@@ -1358,6 +1361,7 @@
 void avd_node_constructor(void)
 {
        NCS_PATRICIA_PARAMS patricia_params;
+       memset(&patricia_params, 0, sizeof(NCS_PATRICIA_PARAMS));
 
        patricia_params.key_size = sizeof(SaNameT);
        osafassert(ncs_patricia_tree_init(&node_name_db, &patricia_params) == 
NCSCC_RC_SUCCESS);
diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -20,7 +20,6 @@
 #include <logtrace.h>
 
 #include <amfd.h>
-#include <cluster.h>
 #include <imm.h>
 
 static NCS_PATRICIA_TREE nodegroup_db;
@@ -280,6 +279,10 @@
        TRACE_ENTER();
 
        ng = avd_ng_get(&opdata->objectName);
+       if (ng == NULL) {
+               report_ccb_validation_error(opdata, "ng modify: nodegroup 
cannot be found");
+               goto done;
+       }
 
        while ((mod = opdata->param.modify.attrMods[i++]) != NULL) {
                if (mod->modType == SA_IMM_ATTR_VALUES_REPLACE) {
@@ -390,12 +393,18 @@
        AVD_AVND *node;
        AVD_AMF_NG *ng = avd_ng_get(&opdata->objectName);
        unsigned int i;
-
+       
+       if (ng == NULL) {
+               report_ccb_validation_error(opdata, "ng delete: nodegroup 
cannot be found");
+               goto done;
+       }
+       
        TRACE_ENTER2("%u", ng->number_nodes);
 
        /* for all nodes in node group */
        for (i = 0; i < ng->number_nodes; i++) {
                node = avd_node_get(&ng->saAmfNGNodeList[i]);
+               osafassert(node);
 
                TRACE("%s", node->name.value);
 
@@ -477,7 +486,8 @@
        TRACE_ENTER();
 
        ng = avd_ng_get(&opdata->objectName);
-
+       osafassert(ng);
+       
        while ((mod = opdata->param.modify.attrMods[i++]) != NULL) {
                switch (mod->modType) {
                case SA_IMM_ATTR_VALUES_ADD: {
@@ -545,6 +555,7 @@
                break;
        case CCBUTIL_DELETE:
                ng = avd_ng_get(&opdata->objectName);
+               osafassert(ng);
                ng_delete(ng);
                TRACE("deleted %s", opdata->objectName.value);
                break;
@@ -561,6 +572,7 @@
 void avd_ng_constructor(void)
 {
        NCS_PATRICIA_PARAMS patricia_params;
+       memset(&patricia_params, 0, sizeof(NCS_PATRICIA_PARAMS));
 
        patricia_params.key_size = sizeof(SaNameT);
        osafassert(ncs_patricia_tree_init(&nodegroup_db, &patricia_params) == 
NCSCC_RC_SUCCESS);
diff --git a/osaf/services/saf/amf/amfd/nodeswbundle.cc 
b/osaf/services/saf/amf/amfd/nodeswbundle.cc
--- a/osaf/services/saf/amf/amfd/nodeswbundle.cc
+++ b/osaf/services/saf/amf/amfd/nodeswbundle.cc
@@ -20,7 +20,6 @@
 #include <immutil.h>
 #include <logtrace.h>
 #include <amfd.h>
-#include <cluster.h>
 #include <imm.h>
 
 /**
@@ -112,6 +111,7 @@
        /* Check if any comps are referencing this bundle */
        avsv_sanamet_init(bundle_dn, &node_dn, "safAmfNode=");
        node = avd_node_get(&node_dn);
+       osafassert(node);
 
        if (!is_swbdl_delete_ok_for_node(bundle_dn, &node_dn, 
node->list_of_ncs_su, opdata))
                return 0;
diff --git a/osaf/services/saf/amf/amfd/ntf.cc 
b/osaf/services/saf/amf/amfd/ntf.cc
--- a/osaf/services/saf/amf/amfd/ntf.cc
+++ b/osaf/services/saf/amf/amfd/ntf.cc
@@ -470,7 +470,7 @@
 
 SaAisErrorT fill_ntf_header_part_avd(SaNtfNotificationHeaderT 
*notificationHeader,
                              SaNtfEventTypeT eventType,
-                             SaNameT comp_name,
+                             const SaNameT& comp_name,
                              SaUint8T *add_text,
                              SaUint16T majorId,
                              SaUint16T minorId,
@@ -528,7 +528,7 @@
 }
 
 uint32_t sendAlarmNotificationAvd(AVD_CL_CB *avd_cb,
-                              SaNameT ntf_object,
+                              const SaNameT& ntf_object,
                               SaUint8T *add_text,
                               SaUint16T majorId,
                               SaUint16T minorId,
@@ -614,7 +614,7 @@
 }
 
 uint32_t sendStateChangeNotificationAvd(AVD_CL_CB *avd_cb,
-                                    SaNameT ntf_object,
+                                    const SaNameT& ntf_object,
                                     SaUint8T *add_text,
                                     SaUint16T majorId,
                                     SaUint16T minorId,

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to