Hi Quyen, Thanks for reviewing it. This compilation error is not observable on gcc 4.9.0 which I have. Anyways I have published version 2.
Thanks, Praveen On 25-Nov-15 11:09 AM, Quyen Dao wrote: > Hi Praveen, > > I got the below error when compiling the latest changeset with your patch. > > comp.cc:1189:30: error: 'value' may be used uninitialized in this function > [-Werror=maybe-uninitialized] > name = *((SaNameT *)value); > ^ > comp.cc:897:9: note: 'value' was declared here > void *value; > ^ > cc1plus: all warnings being treated as errors > make[7]: *** [osafamfd-comp.o] Error 1 > > Thanks, > Quyen > > -----Original Message----- > From: [email protected] [mailto:[email protected]] > Sent: Tuesday, November 24, 2015 12:47 PM > To: [email protected]; [email protected]; > [email protected] > Cc: [email protected] > Subject: [PATCH 1 of 1] amfd: fix amfd assert during modofication of comp > attributes [#1592] > > osaf/services/saf/amf/amfd/comp.cc | 62 > ++++++++++++++++++++++++++++++++++--- > 1 files changed, 57 insertions(+), 5 deletions(-) > > > Following three commands causes assert in amfd: > immcfg -a saAmfCompNumMaxAmStopAttempts= > safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1 > immcfg -a saAmfCompNumMaxAmStartAttempts= > safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1 > immcfg -a osafAmfCompHcCmdArgv= > safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo1 > > Patch rejects CCB modification on unsupported attributes and avoids amfd > assert. > > diff --git a/osaf/services/saf/amf/amfd/comp.cc > b/osaf/services/saf/amf/amfd/comp.cc > --- a/osaf/services/saf/amf/amfd/comp.cc > +++ b/osaf/services/saf/amf/amfd/comp.cc > @@ -886,6 +886,7 @@ static SaAisErrorT ccb_completed_modify_ > int i = 0; > AVD_COMP *comp; > SaAisErrorT rc = SA_AIS_ERR_BAD_OPERATION; > + bool value_is_deleted; > > TRACE_ENTER(); > > @@ -895,13 +896,18 @@ static SaAisErrorT ccb_completed_modify_ > const SaImmAttrValuesT_2 *attribute = &attr_mod->modAttr; > void *value; > > - /* Attribute value removed */ > - if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) || > (attribute->attrValues == nullptr)) > - continue; > - > - value = attribute->attrValues[0]; > + if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) || > (attribute->attrValues == nullptr)) { > + /* Attribute value is deleted, revert to default > value */ > + value_is_deleted = true; > + } else { > + /* Attribute value is modified */ > + value_is_deleted = false; > + value = attribute->attrValues[0]; > + } > > if (!strcmp(attribute->attrName, "saAmfCompType")) { > + if (value_is_deleted == true) > + continue; > SaNameT dn = *((SaNameT*)value); > if (nullptr == > comptype_db->find(Amf::to_string(&dn))) { > report_ccb_validation_error(opdata, > "saAmfCompType '%s' not found", dn.value); > @@ -941,6 +947,8 @@ static SaAisErrorT ccb_completed_modify_ > } > } > } else if (!strcmp(attribute->attrName, > "saAmfCompInstantiateCmdArgv")) { > + if (value_is_deleted == true) > + continue; > char *param_val = *((char **)value); > if (nullptr == param_val) { > report_ccb_validation_error(opdata, > @@ -948,6 +956,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompInstantiateTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -956,6 +966,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompInstantiationLevel")) { > + if (value_is_deleted == true) > + continue; > uint32_t num_inst = *((SaUint32T *)value); > if (num_inst == 0) { > report_ccb_validation_error(opdata, > "Modification of saAmfCompInstantiationLevel Fail," > @@ -963,6 +975,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompNumMaxInstantiateWithoutDelay")) { > + if (value_is_deleted == true) > + continue; > uint32_t num_inst = *((SaUint32T *)value); > if (num_inst == 0) { > report_ccb_validation_error(opdata, > "Modification of saAmfCompNumMaxInstantiateWithoutDelay" > @@ -970,6 +984,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompNumMaxInstantiateWithDelay")) { > + if (value_is_deleted == true) > + continue; > uint32_t num_inst = *((SaUint32T *)value); > if (num_inst == 0) { > report_ccb_validation_error(opdata, > "Modification of saAmfCompNumMaxInstantiateWithDelay" > @@ -977,6 +993,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompDelayBetweenInstantiateAttempts")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -985,6 +1003,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompTerminateCmdArgv")) { > + if (value_is_deleted == true) > + continue; > char *param_val = *((char **)value); > if (nullptr == param_val) { > report_ccb_validation_error(opdata, > @@ -992,6 +1012,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompTerminateTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -1000,6 +1022,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompCleanupCmdArgv")) { > + if (value_is_deleted == true) > + continue; > char *param_val = *((char **)value); > if (nullptr == param_val) { > report_ccb_validation_error(opdata, > @@ -1007,6 +1031,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompCleanupTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -1015,6 +1041,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompAmStartCmdArgv")) { > + if (value_is_deleted == true) > + continue; > char *param_val = *((char **)value); > if (nullptr == param_val) { > report_ccb_validation_error(opdata, > @@ -1027,6 +1055,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompAmStartTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -1040,6 +1070,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompNumMaxAmStartAttempt")) { > + if (value_is_deleted == true) > + continue; > uint32_t num_am_start = *((SaUint32T *)value); > if (true == comp->su->su_is_external) { > report_ccb_validation_error(opdata, > "Modification of saAmfCompNumMaxAmStartAttempt Fail," > @@ -1052,6 +1084,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompAmStopCmdArgv")) { > + if (value_is_deleted == true) > + continue; > char *param_val = *((char **)value); > if (true == comp->su->su_is_external) { > report_ccb_validation_error(opdata, > @@ -1063,6 +1097,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompAmStopTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > if (true == comp->su->su_is_external) { > report_ccb_validation_error(opdata, > @@ -1076,6 +1112,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompNumMaxAmStopAttempt")) { > + if (value_is_deleted == true) > + continue; > uint32_t num_am_stop = *((SaUint32T *)value); > if (true == comp->su->su_is_external) { > report_ccb_validation_error(opdata, > "Modification of saAmfCompNumMaxAmStopAttempt Fail," > @@ -1088,6 +1126,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompCSISetCallbackTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -1096,6 +1136,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompCSIRmvCallbackTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -1104,6 +1146,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompQuiescingCompleteTimeout")) { > + if (value_is_deleted == true) > + continue; > SaTimeT timeout; > m_NCS_OS_HTONLL_P(&timeout, (*((SaTimeT *)value))); > if (timeout == 0) { > @@ -1112,6 +1156,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompRecoveryOnError")) { > + if (value_is_deleted == true) > + continue; > uint32_t recovery = *((SaUint32T *)value); > if ((recovery < SA_AMF_NO_RECOMMENDATION) || > (recovery > SA_AMF_CONTAINER_RESTART )) { > report_ccb_validation_error(opdata, > "Modification of saAmfCompRecoveryOnError Fail," > @@ -1119,6 +1165,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompDisableRestart")) { > + if (value_is_deleted == true) > + continue; > SaBoolT val = *((SaBoolT *)value); > if ((val != SA_TRUE) && (val != SA_FALSE)) { > report_ccb_validation_error(opdata, > @@ -1126,6 +1174,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompProxyCsi")) { > + if (value_is_deleted == true) > + continue; > SaNameT name; > name = *((SaNameT *)value); > if (name.length == 0) { > @@ -1133,6 +1183,8 @@ static SaAisErrorT ccb_completed_modify_ > goto done; > } > } else if (!strcmp(attribute->attrName, > "saAmfCompContainerCsi")) { > + if (value_is_deleted == true) > + continue; > SaNameT name; > name = *((SaNameT *)value); > if (name.length == 0) { > ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
