osaf/services/saf/amf/amfd/su.cc | 14 ++++++++++++--
osaf/services/saf/amf/amfd/sutcomptype.cc | 4 +++-
osaf/services/saf/amf/amfd/sutype.cc | 12 +++++-------
osaf/services/saf/amf/amfd/svctype.cc | 6 +++---
osaf/services/saf/amf/amfd/svctypecstypes.cc | 6 ++++--
osaf/services/saf/amf/amfd/util.cc | 2 +-
6 files changed, 28 insertions(+), 16 deletions(-)
* Dereference null return value (NULL_RETURNS)
* Uninitialized scalar variable (UNINIT)
* Unused pointer value (UNUSED_VALUE)
* Unnecessary header file (HFA)
diff --git a/osaf/services/saf/amf/amfd/su.cc b/osaf/services/saf/amf/amfd/su.cc
--- a/osaf/services/saf/amf/amfd/su.cc
+++ b/osaf/services/saf/amf/amfd/su.cc
@@ -384,7 +384,7 @@
}
ng_of_sg = avd_ng_get(&saAmfSGSuHostNodeGroup);
- if (ng_of_su == NULL) {
+ if (ng_of_sg == NULL) {
report_ccb_validation_error(opdata, "Invalid
saAmfSGSuHostNodeGroup '%s' for '%s'",
saAmfSGSuHostNodeGroup.value, dn->value);
return 0;
@@ -531,6 +531,7 @@
/* If node is configured in SU we are done */
if (strstr((char *)su->saAmfSUHostNodeOrNodeGroup.value, "safAmfNode=")
!= NULL) {
node = avd_node_get(&su->saAmfSUHostNodeOrNodeGroup);
+ osafassert(node);
goto done;
}
@@ -569,6 +570,7 @@
/* All nodes already have an SU mapped for the SG. Return a node in the
node group. */
node = avd_node_get(&ng->saAmfNGNodeList[0]);
+ osafassert(node);
done:
memcpy(&su->saAmfSUHostedByNode, &node->name, sizeof(SaNameT));
TRACE_LEAVE2("hosted by %s", node->name.value);
@@ -620,6 +622,7 @@
} else {
/* Already mapped, setup the node link */
su->su_on_node = avd_node_get(&su->saAmfSUHostedByNode);
+ osafassert(su->su_on_node);
}
avd_node_add_su(su);
@@ -1244,6 +1247,7 @@
if (!strcmp(attr_mod->modAttr.attrName, "saAmfSUFailover")) {
AVD_SU *su = avd_su_get(&opdata->objectName);
+ osafassert(su);
uint32_t su_failover = *((SaUint32T
*)attr_mod->modAttr.attrValues[0]);
/* If SG is not in stable state and amfnd is already
busy in the handling of some fault,
@@ -1264,6 +1268,7 @@
}
} else if (!strcmp(attr_mod->modAttr.attrName,
"saAmfSUMaintenanceCampaign")) {
AVD_SU *su = avd_su_get(&opdata->objectName);
+ osafassert(su);
if (su->saAmfSUMaintenanceCampaign.length > 0) {
report_ccb_validation_error(opdata,
"saAmfSUMaintenanceCampaign already set for %s",
@@ -1275,6 +1280,7 @@
AVD_SU *su;
SaNameT sutype_name = *(SaNameT*)
attr_mod->modAttr.attrValues[0];
su = avd_su_get(&opdata->objectName);
+ osafassert(su);
if(SA_AMF_ADMIN_LOCKED_INSTANTIATION !=
su->saAmfSUAdminState) {
report_ccb_validation_error(opdata, "SU is not
in locked-inst, present state '%d'",
su->saAmfSUAdminState);
@@ -1429,6 +1435,8 @@
TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId,
opdata->objectName.value);
su = avd_su_get(&opdata->objectName);
+ // su should not be null
+ osafassert(su);
while ((attr_mod = opdata->param.modify.attrMods[i++]) != NULL) {
/* Attribute value removed */
@@ -1467,6 +1475,7 @@
SaNameT sutype_name = *(SaNameT*)
attr_mod->modAttr.attrValues[0];
TRACE("Modified saAmfSUType from '%s' to '%s'",
su->saAmfSUType.value, sutype_name.value);
sut = avd_sutype_get(&sutype_name);
+ osafassert(sut);
avd_sutype_remove_su(su);
su->saAmfSUType = sutype_name;
su->su_type = sut;
@@ -1604,7 +1613,8 @@
void avd_su_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(&su_db, &patricia_params) ==
NCSCC_RC_SUCCESS);
diff --git a/osaf/services/saf/amf/amfd/sutcomptype.cc
b/osaf/services/saf/amf/amfd/sutcomptype.cc
--- a/osaf/services/saf/amf/amfd/sutcomptype.cc
+++ b/osaf/services/saf/amf/amfd/sutcomptype.cc
@@ -107,7 +107,7 @@
while (immutil_saImmOmSearchNext_2(searchHandle, &dn,
(SaImmAttrValuesT_2 ***)&attributes) == SA_AIS_OK) {
if (!is_config_valid(&dn, attributes, NULL))
goto done2;
- if ((sutcomptype = avd_sutcomptype_get(&dn)) == NULL) {
+ if (avd_sutcomptype_get(&dn) == NULL) {
if ((sutcomptype = sutcomptype_create(&dn, attributes))
== NULL) {
error = SA_AIS_ERR_FAILED_OPERATION;
goto done2;
@@ -143,6 +143,7 @@
break;
case CCBUTIL_DELETE:
sutcomptype = avd_sutcomptype_get(&opdata->objectName);
+ osafassert(sutcomptype);
if (sutcomptype->curr_num_components == 0) {
rc = SA_AIS_OK;
opdata->userData = sutcomptype; /* Save for later use
in apply */
@@ -180,6 +181,7 @@
void avd_sutcomptype_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(&sutcomptype_db, &patricia_params) ==
NCSCC_RC_SUCCESS);
diff --git a/osaf/services/saf/amf/amfd/sutype.cc
b/osaf/services/saf/amf/amfd/sutype.cc
--- a/osaf/services/saf/amf/amfd/sutype.cc
+++ b/osaf/services/saf/amf/amfd/sutype.cc
@@ -23,7 +23,6 @@
#include <util.h>
#include <sutype.h>
#include <imm.h>
-#include <cluster.h>
#include <ntf.h>
#include <proc.h>
@@ -74,7 +73,6 @@
{
const SaImmAttrValuesT_2 *attr;
struct avd_sutype *sutype;
- int rc = 0;
unsigned i = 0;
SaAisErrorT error;
@@ -109,11 +107,6 @@
TRACE("%s", sutype->saAmfSutProvidesSvcTypes[i].value);
}
- rc = 0;
-
- if (rc != 0)
- sutype_delete(&sutype);
-
return sutype;
}
@@ -243,6 +236,7 @@
TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId,
opdata->objectName.value);
avd_sutype *sut = avd_sutype_get(&opdata->objectName);
+ osafassert(sut);
while ((attr_mod = opdata->param.modify.attrMods[i++]) != NULL) {
if (!strcmp(attr_mod->modAttr.attrName,
"saAmfSutDefSUFailover")) {
@@ -286,6 +280,7 @@
break;
case CCBUTIL_DELETE:
sut = avd_sutype_get(&opdata->objectName);
+ osafassert(sut);
sutype_db_delete(sut);
sutype_delete(&sut);
break;
@@ -308,6 +303,7 @@
const SaImmAttrModificationT_2 *attr_mod;
int i = 0;
avd_sutype *sut = avd_sutype_get(&opdata->objectName);
+ osafassert(sut);
TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId,
opdata->objectName.value);
while ((attr_mod = opdata->param.modify.attrMods[i++]) != NULL) {
@@ -374,6 +370,7 @@
break;
case CCBUTIL_DELETE:
sut = avd_sutype_get(&opdata->objectName);
+ osafassert(sut);
if (NULL != sut->list_of_su) {
/* check whether there exists a delete operation for
* each of the SU in the su_type list in the current
CCB
@@ -441,6 +438,7 @@
void avd_sutype_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(&sutype_db, &patricia_params) ==
NCSCC_RC_SUCCESS);
diff --git a/osaf/services/saf/amf/amfd/svctype.cc
b/osaf/services/saf/amf/amfd/svctype.cc
--- a/osaf/services/saf/amf/amfd/svctype.cc
+++ b/osaf/services/saf/amf/amfd/svctype.cc
@@ -22,10 +22,8 @@
#include <saImmOm.h>
#include <immutil.h>
#include <app.h>
-#include <cluster.h>
#include <imm.h>
#include <susi.h>
-#include <csi.h>
#include <proc.h>
static NCS_PATRICIA_TREE svctype_db;
@@ -140,6 +138,7 @@
break;
case CCBUTIL_DELETE:
svc_type = avd_svctype_get(&opdata->objectName);
+ osafassert(svc_type);
if (NULL != svc_type->list_of_si) {
/* check whether there exists a delete operation for
* each of the SI in the svc_type list in the current
CCB
@@ -230,7 +229,7 @@
if (!is_config_valid(&dn, attributes, NULL))
goto done2;
- if ((svc_type = avd_svctype_get(&dn))==NULL) {
+ if (avd_svctype_get(&dn) == NULL) {
if ((svc_type = svctype_create(&dn, attributes)) ==
NULL)
goto done2;
@@ -289,6 +288,7 @@
void avd_svctype_constructor(void)
{
NCS_PATRICIA_PARAMS patricia_params;
+ memset(&patricia_params, 0, sizeof(NCS_PATRICIA_PARAMS));
patricia_params.key_size = sizeof(SaNameT);
diff --git a/osaf/services/saf/amf/amfd/svctypecstypes.cc
b/osaf/services/saf/amf/amfd/svctypecstypes.cc
--- a/osaf/services/saf/amf/amfd/svctypecstypes.cc
+++ b/osaf/services/saf/amf/amfd/svctypecstypes.cc
@@ -100,7 +100,7 @@
while (immutil_saImmOmSearchNext_2(searchHandle, &dn,
(SaImmAttrValuesT_2 ***)&attributes) == SA_AIS_OK) {
- if ((svctypecstype = avd_svctypecstypes_get(&dn))== NULL) {
+ if (avd_svctypecstypes_get(&dn) == NULL) {
if ((svctypecstype = svctypecstypes_create(&dn,
attributes)) == NULL) {
error = SA_AIS_ERR_FAILED_OPERATION;
goto done2;
@@ -139,6 +139,7 @@
break;
case CCBUTIL_DELETE:
svctypecstype = avd_svctypecstypes_get(&opdata->objectName);
+ osafassert(svctypecstype);
if (svctypecstype->curr_num_csis == 0) {
rc = SA_AIS_OK;
opdata->userData = svctypecstype;
@@ -182,7 +183,8 @@
void avd_svctypecstypes_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(&svctypecstypes_db, &patricia_params)
== NCSCC_RC_SUCCESS);
avd_class_impl_set(const_cast<SaImmClassNameT>("SaAmfSvcTypeCSTypes"),
NULL, NULL, svctypecstypes_ccb_completed_cb, svctypecstypes_ccb_apply_cb);
diff --git a/osaf/services/saf/amf/amfd/util.cc
b/osaf/services/saf/amf/amfd/util.cc
--- a/osaf/services/saf/amf/amfd/util.cc
+++ b/osaf/services/saf/amf/amfd/util.cc
@@ -1582,7 +1582,7 @@
bool object_exist_in_imm(const SaNameT *dn)
{
bool rc = false;
- SaImmAccessorHandleT accessorHandle;
+ SaImmAccessorHandleT accessorHandle = 0;
const SaImmAttrValuesT_2 **attributes;
SaImmAttrNameT attributeNames[] =
{const_cast<SaImmAttrNameT>("SaImmAttrClassName"), NULL};
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel