Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Gary, The V1 patch is failing to apply cleanly on OpenSAF 5.2.RC1 tagged code, so i re-based with V2 , also fixed additional issue , that you said in V1 and they are considerable so I republished V2 with completely. -AVM On 3/14/2017 12:39 PM, Gary Lee wrote: > Hi Mahesh > > Perhaps it's easier if you pushed V1 first. Otherwise the patches get even > bigger and harder to review. I was referring to regression tests failing > without the changes I proposed, when I said legacy tests failed. > > thanks > >> On 14 Mar 2017, at 6:01 pm, A V Maheshwrote: >> >> Hi Gary, >> >> Previously you found some old application issue and you resolved it is that >> related to this path or different issue ? >> >> -AVM >> >> >>> On 3/14/2017 12:20 PM, A V Mahesh wrote: >>> Hi Gar, >>> >>> Thanks for the review. >>> On 3/14/2017 11:47 AM, Gary Lee wrote: By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, but this is a great improvement. >>> Ok will re-run the Cppcheck and if we find considerable , I will >>> re-publish the V2 patch. >>> >>> -AVM >>> On 3/14/2017 11:47 AM, Gary Lee wrote: Hi Mahesh Ack for the series (regression tests run) with the following changes. By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, but this is a great improvement. Thanks Gary diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc --- a/src/amf/amfd/csi.cc +++ b/src/amf/amfd/csi.cc @@ -1399,12 +1399,13 @@ void avd_csi_remove_csiattr(AVD_CSI *csi void avd_csi_add_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *csiattr) { -int cnt = 0; +int cnt = 1; AVD_CSI_ATTR *ptr; TRACE_ENTER(); /* Count number of attributes (multivalue) */ ptr = csiattr; +osafassert(ptr != nullptr); while (ptr->attr_next != nullptr) { cnt++; ptr = ptr->attr_next; diff --git a/src/amf/amfnd/cpm.cc b/src/amf/amfnd/cpm.cc --- a/src/amf/amfnd/cpm.cc +++ b/src/amf/amfnd/cpm.cc @@ -145,7 +145,7 @@ void avnd_comp_pm_rec_del(AVND_CB *cb, A LOG_NO("PM Rec doesn't exist in Comp '%s' of pid %llu", comp->name.c_str(), pid); } -delete rec;/* rec is no more, dont use it */ +rec = nullptr;/* rec is no more, dont use it */ /* remove the corresponding element from mon_req list */ rc = avnd_mon_req_del(cb, pid); -Original Message- From: A V Mahesh Date: Wednesday, 8 March 2017 at 11:28 pm To: , gary , , Cc: Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1 Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 Review request for Trac Ticket(s): #2341 Peer Reviewer(s): Amf Dev Pull request to: <> Affected branch(es): default, 5.2 Development branch: default Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a Author:A V Mahesh Date:Wed, 08 Mar 2017 17:52:21 +0530 amfd: Fix all Cppcheck 1.77 issues [#2341] V1 [staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 'i' can be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) Condition 'rc!=0' is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The scope of the variable 'sg_type' can be reduced. [staging/src/amf/amfd/chkop.cc:1297] -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:374] -> [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is reassigned a value before the old one has been used.
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Mahesh Perhaps it's easier if you pushed V1 first. Otherwise the patches get even bigger and harder to review. I was referring to regression tests failing without the changes I proposed, when I said legacy tests failed. thanks > On 14 Mar 2017, at 6:01 pm, A V Maheshwrote: > > Hi Gary, > > Previously you found some old application issue and you resolved it is that > related to this path or different issue ? > > -AVM > > >> On 3/14/2017 12:20 PM, A V Mahesh wrote: >> Hi Gar, >> >> Thanks for the review. >> >>> On 3/14/2017 11:47 AM, Gary Lee wrote: >>> By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, >>> but this is a great improvement. >> Ok will re-run the Cppcheck and if we find considerable , I will >> re-publish the V2 patch. >> >> -AVM >> >>> On 3/14/2017 11:47 AM, Gary Lee wrote: >>> Hi Mahesh >>> >>> Ack for the series (regression tests run) with the following changes. >>> >>> By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, >>> but this is a great improvement. >>> >>> Thanks >>> Gary >>> >>> diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc >>> --- a/src/amf/amfd/csi.cc >>> +++ b/src/amf/amfd/csi.cc >>> @@ -1399,12 +1399,13 @@ void avd_csi_remove_csiattr(AVD_CSI *csi >>> void avd_csi_add_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *csiattr) >>> { >>> -int cnt = 0; >>> +int cnt = 1; >>> AVD_CSI_ATTR *ptr; >>> TRACE_ENTER(); >>> /* Count number of attributes (multivalue) */ >>> ptr = csiattr; >>> +osafassert(ptr != nullptr); >>> while (ptr->attr_next != nullptr) { >>> cnt++; >>> ptr = ptr->attr_next; >>> diff --git a/src/amf/amfnd/cpm.cc b/src/amf/amfnd/cpm.cc >>> --- a/src/amf/amfnd/cpm.cc >>> +++ b/src/amf/amfnd/cpm.cc >>> @@ -145,7 +145,7 @@ void avnd_comp_pm_rec_del(AVND_CB *cb, A >>> LOG_NO("PM Rec doesn't exist in Comp '%s' of pid %llu", >>> comp->name.c_str(), pid); >>> } >>> -delete rec;/* rec is no more, dont use it */ >>> +rec = nullptr;/* rec is no more, dont use it */ >>> /* remove the corresponding element from mon_req list */ >>> rc = avnd_mon_req_del(cb, pid); >>> >>> >>> -Original Message- >>> From: A V Mahesh >>> Date: Wednesday, 8 March 2017 at 11:28 pm >>> To: , gary , >>> , >>> Cc: >>> Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 >>> issues [#2341] V1 >>> >>> Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 >>> Review request for Trac Ticket(s): #2341 >>> Peer Reviewer(s): Amf Dev >>> Pull request to: <> >>> Affected branch(es): default, 5.2 >>> Development branch: default >>> >>> Impacted area Impact y/n >>> >>> Docsn >>> Build systemn >>> RPM/packaging n >>> Configuration files n >>> Startup scripts n >>> SAF servicesn >>> OpenSAF servicesy >>> Core libraries n >>> Samples n >>> Tests n >>> Other n >>> Comments (indicate scope for each "y" above): >>> - >>>changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a >>> Author:A V Mahesh >>> Date:Wed, 08 Mar 2017 17:52:21 +0530 >>>amfd: Fix all Cppcheck 1.77 issues [#2341] V1 >>>[staging/src/amf/amfd/app.cc:285]: (style) The scope of the >>> variable 'i' can >>> be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) >>> Condition 'rc!=0' >>> is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The >>> scope of >>> the variable 'sg_type' can be reduced. >>> [staging/src/amf/amfd/chkop.cc:1297] >>> -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is >>> reassigned a value before the old one has been used. >>> [staging/src/amf/amfd/ckpt_dec.cc:374] -> >>> [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' >>> is >>> reassigned a value before the old one has been used. >>> [staging/src/amf/amfd/ckpt_dec.cc:573] -> >>> [staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' >>> is >>> reassigned a value before the old one has been used. >>> [staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer >>> prefix ++/-- >>> operators for non-primitive types. >>> [staging/src/amf/amfd/ckpt_edu.cc:51] -> >>> [staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Gary, Previously you found some old application issue and you resolved it is that related to this path or different issue ? -AVM On 3/14/2017 12:20 PM, A V Mahesh wrote: > Hi Gar, > > Thanks for the review. > > On 3/14/2017 11:47 AM, Gary Lee wrote: >> By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, >> but this is a great improvement. > Ok will re-run the Cppcheck and if we find considerable , I will > re-publish the V2 patch. > > -AVM > > On 3/14/2017 11:47 AM, Gary Lee wrote: >> Hi Mahesh >> >> Ack for the series (regression tests run) with the following changes. >> >> By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, >> but this is a great improvement. >> >> Thanks >> Gary >> >> diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc >> --- a/src/amf/amfd/csi.cc >> +++ b/src/amf/amfd/csi.cc >> @@ -1399,12 +1399,13 @@ void avd_csi_remove_csiattr(AVD_CSI *csi >> >>void avd_csi_add_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *csiattr) >>{ >> -int cnt = 0; >> +int cnt = 1; >> AVD_CSI_ATTR *ptr; >> >> TRACE_ENTER(); >> /* Count number of attributes (multivalue) */ >> ptr = csiattr; >> +osafassert(ptr != nullptr); >> while (ptr->attr_next != nullptr) { >> cnt++; >> ptr = ptr->attr_next; >> diff --git a/src/amf/amfnd/cpm.cc b/src/amf/amfnd/cpm.cc >> --- a/src/amf/amfnd/cpm.cc >> +++ b/src/amf/amfnd/cpm.cc >> @@ -145,7 +145,7 @@ void avnd_comp_pm_rec_del(AVND_CB *cb, A >> LOG_NO("PM Rec doesn't exist in Comp '%s' of pid %llu", >> comp->name.c_str(), pid); >> } >> >> -delete rec; /* rec is no more, dont use it */ >> +rec = nullptr; /* rec is no more, dont use it */ >> >> /* remove the corresponding element from mon_req list */ >> rc = avnd_mon_req_del(cb, pid); >> >> >> -Original Message- >> From: A V Mahesh>> Date: Wednesday, 8 March 2017 at 11:28 pm >> To: , gary , >> , >> Cc: >> Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues >> [#2341] V1 >> >> Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 >> Review request for Trac Ticket(s): #2341 >> Peer Reviewer(s): Amf Dev >> Pull request to: <> >> Affected branch(es): default, 5.2 >> Development branch: default >> >> >> Impacted area Impact y/n >> >>Docsn >>Build systemn >>RPM/packaging n >>Configuration files n >>Startup scripts n >>SAF servicesn >>OpenSAF servicesy >>Core libraries n >>Samples n >>Tests n >>Other n >> >> >> Comments (indicate scope for each "y" above): >> - >> >> changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a >> Author:A V Mahesh >> Date: Wed, 08 Mar 2017 17:52:21 +0530 >> >> amfd: Fix all Cppcheck 1.77 issues [#2341] V1 >> >> [staging/src/amf/amfd/app.cc:285]: (style) The scope of the >> variable 'i' can >> be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) >> Condition 'rc!=0' >> is always false [staging/src/amf/amfd/apptype.cc:69]: (style) >> The scope of >> the variable 'sg_type' can be reduced. >> [staging/src/amf/amfd/chkop.cc:1297] >> -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' >> is >> reassigned a value before the old one has been used. >> [staging/src/amf/amfd/ckpt_dec.cc:374] -> >> [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable >> 'status' is >> reassigned a value before the old one has been used. >> [staging/src/amf/amfd/ckpt_dec.cc:573] -> >> [staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable >> 'status' is >> reassigned a value before the old one has been used. >> [staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer >> prefix ++/-- >> operators for non-primitive types. >> [staging/src/amf/amfd/ckpt_edu.cc:51] -> >> [staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable 'rc' is >> reassigned a >> value before the old one has been used. >> [staging/src/amf/amfd/ckpt_enc.cc:2281] -> >> [staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable >> 'status' is >> reassigned a value before the old one has been used. >>
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Gar, Thanks for the review. On 3/14/2017 11:47 AM, Gary Lee wrote: > By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, > but this is a great improvement. Ok will re-run the Cppcheck and if we find considerable , I will re-publish the V2 patch. -AVM On 3/14/2017 11:47 AM, Gary Lee wrote: > Hi Mahesh > > Ack for the series (regression tests run) with the following changes. > > By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, > but this is a great improvement. > > Thanks > Gary > > diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc > --- a/src/amf/amfd/csi.cc > +++ b/src/amf/amfd/csi.cc > @@ -1399,12 +1399,13 @@ void avd_csi_remove_csiattr(AVD_CSI *csi > > void avd_csi_add_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *csiattr) > { > - int cnt = 0; > + int cnt = 1; > AVD_CSI_ATTR *ptr; > > TRACE_ENTER(); > /* Count number of attributes (multivalue) */ > ptr = csiattr; > + osafassert(ptr != nullptr); > while (ptr->attr_next != nullptr) { > cnt++; > ptr = ptr->attr_next; > diff --git a/src/amf/amfnd/cpm.cc b/src/amf/amfnd/cpm.cc > --- a/src/amf/amfnd/cpm.cc > +++ b/src/amf/amfnd/cpm.cc > @@ -145,7 +145,7 @@ void avnd_comp_pm_rec_del(AVND_CB *cb, A > LOG_NO("PM Rec doesn't exist in Comp '%s' of pid %llu", > comp->name.c_str(), pid); > } > > - delete rec; /* rec is no more, dont use it */ > + rec = nullptr; /* rec is no more, dont use it */ > > /* remove the corresponding element from mon_req list */ > rc = avnd_mon_req_del(cb, pid); > > > -Original Message- > From: A V Mahesh> Date: Wednesday, 8 March 2017 at 11:28 pm > To: , gary , > , > Cc: > Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues > [#2341] V1 > > Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 > Review request for Trac Ticket(s): #2341 > Peer Reviewer(s): Amf Dev > Pull request to: <> > Affected branch(es): default, 5.2 > Development branch: default > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesn > OpenSAF servicesy > Core libraries n > Samples n > Tests n > Other n > > > Comments (indicate scope for each "y" above): > - > > changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a > Author: A V Mahesh > Date:Wed, 08 Mar 2017 17:52:21 +0530 > > amfd: Fix all Cppcheck 1.77 issues [#2341] V1 > > [staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable > 'i' can > be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) Condition > 'rc!=0' > is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The scope > of > the variable 'sg_type' can be reduced. > [staging/src/amf/amfd/chkop.cc:1297] > -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_dec.cc:374] -> > [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_dec.cc:573] -> > [staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_edu.cc:51] -> > [staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable 'rc' is > reassigned a > value before the old one has been used. > [staging/src/amf/amfd/ckpt_enc.cc:2281] -> > [staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_enc.cc:2314] -> > [staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:1982]: > (performance) Prefer prefix ++/-- operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2015]:
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Mahesh Ack for the series (regression tests run) with the following changes. By the way, I still see cppcheck issues in AMF when I run ‘make cppcheck’, but this is a great improvement. Thanks Gary diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc --- a/src/amf/amfd/csi.cc +++ b/src/amf/amfd/csi.cc @@ -1399,12 +1399,13 @@ void avd_csi_remove_csiattr(AVD_CSI *csi void avd_csi_add_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *csiattr) { - int cnt = 0; + int cnt = 1; AVD_CSI_ATTR *ptr; TRACE_ENTER(); /* Count number of attributes (multivalue) */ ptr = csiattr; + osafassert(ptr != nullptr); while (ptr->attr_next != nullptr) { cnt++; ptr = ptr->attr_next; diff --git a/src/amf/amfnd/cpm.cc b/src/amf/amfnd/cpm.cc --- a/src/amf/amfnd/cpm.cc +++ b/src/amf/amfnd/cpm.cc @@ -145,7 +145,7 @@ void avnd_comp_pm_rec_del(AVND_CB *cb, A LOG_NO("PM Rec doesn't exist in Comp '%s' of pid %llu", comp->name.c_str(), pid); } - delete rec; /* rec is no more, dont use it */ + rec = nullptr; /* rec is no more, dont use it */ /* remove the corresponding element from mon_req list */ rc = avnd_mon_req_del(cb, pid); -Original Message- From: A V MaheshDate: Wednesday, 8 March 2017 at 11:28 pm To: , gary , , Cc: Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1 Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 Review request for Trac Ticket(s): #2341 Peer Reviewer(s): Amf Dev Pull request to: <> Affected branch(es): default, 5.2 Development branch: default Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a Author: A V Mahesh Date: Wed, 08 Mar 2017 17:52:21 +0530 amfd: Fix all Cppcheck 1.77 issues [#2341] V1 [staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 'i' can be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) Condition 'rc!=0' is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The scope of the variable 'sg_type' can be reduced. [staging/src/amf/amfd/chkop.cc:1297] -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:374] -> [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:573] -> [staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_edu.cc:51] -> [staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_enc.cc:2281] -> [staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_enc.cc:2314] -> [staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:1982]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2044]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2111]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance)
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Mahesh I’m still going through it. Seems to be mainly asserts and coredumps. Eg. csi->num_attributes is not set properly. The fix below seems to work. diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc --- a/src/amf/amfd/csi.cc +++ b/src/amf/amfd/csi.cc @@ -1399,12 +1399,13 @@ void avd_csi_remove_csiattr(AVD_CSI *csi void avd_csi_add_csiattr(AVD_CSI *csi, AVD_CSI_ATTR *csiattr) { - int cnt = 0; + int cnt = 1; AVD_CSI_ATTR *ptr; TRACE_ENTER(); /* Count number of attributes (multivalue) */ ptr = csiattr; + osafassert(ptr != nullptr); while (ptr->attr_next != nullptr) { cnt++; ptr = ptr->attr_next; Coredumps: ==428== Thread 1: ==428== Invalid free() / delete / delete[] / realloc() ==428==at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==428==by 0x132CD1: avnd_comp_pm_rec_del(avnd_cb_tag*, avnd_comp_tag*, avnd_pm_rec*) (cpm.cc:148) ==428==by 0x1434C4: avnd_evt_pid_exit_evh(avnd_cb_tag*, avnd_evt_tag*) (mon.cc:408) ==428==by 0x14061E: avnd_evt_process (main.cc:665) ==428==by 0x14061E: avnd_main_process() (main.cc:616) ==428==by 0x1164FE: main (main.cc:206) ==428== Address 0x81c7c70 is 0 bytes inside a block of size 72 free'd ==428==at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==428==by 0x132B68: avnd_pm_rec_free(ncs_db_link_list_node*) (cpm.cc:86) ==428==by 0x56B9B9A: ncs_db_link_list_del (ncsdlib.c:144) ==428==by 0x132C9E: avnd_comp_pm_rec_del(avnd_cb_tag*, avnd_comp_tag*, avnd_pm_rec*) (cpm.cc:143) ==428==by 0x1434C4: avnd_evt_pid_exit_evh(avnd_cb_tag*, avnd_evt_tag*) (mon.cc:408) ==428==by 0x14061E: avnd_evt_process (main.cc:665) ==428==by 0x14061E: avnd_main_process() (main.cc:616) ==428==by 0x1164FE: main (main.cc:206) ==428== ==428== Invalid free() / delete / delete[] / realloc() ==428==at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==428==by 0x132CD1: avnd_comp_pm_rec_del(avnd_cb_tag*, avnd_comp_tag*, avnd_pm_rec*) (cpm.cc:148) ==428==by 0x132F3B: avnd_comp_pm_stop_process(avnd_cb_tag*, avnd_comp_tag*, avsv_amf_pm_stop_param_tag*, SaAisErrorT*) (cpm.cc:227) ==428==by 0x133994: avnd_evt_ava_pm_stop_evh(avnd_cb_tag*, avnd_evt_tag*) (cpm.cc:485) ==428==by 0x14061E: avnd_evt_process (main.cc:665) ==428==by 0x14061E: avnd_main_process() (main.cc:616) ==428==by 0x1164FE: main (main.cc:206) ==428== Address 0x81ccea0 is 0 bytes inside a block of size 72 free'd ==428==at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==428==by 0x132B68: avnd_pm_rec_free(ncs_db_link_list_node*) (cpm.cc:86) ==428==by 0x56B9B9A: ncs_db_link_list_del (ncsdlib.c:144) ==428==by 0x132C9E: avnd_comp_pm_rec_del(avnd_cb_tag*, avnd_comp_tag*, avnd_pm_rec*) (cpm.cc:143) ==428==by 0x132F3B: avnd_comp_pm_stop_process(avnd_cb_tag*, avnd_comp_tag*, avsv_amf_pm_stop_param_tag*, SaAisErrorT*) (cpm.cc:227) ==428==by 0x133994: avnd_evt_ava_pm_stop_evh(avnd_cb_tag*, avnd_evt_tag*) (cpm.cc:485) ==428==by 0x14061E: avnd_evt_process (main.cc:665) ==428==by 0x14061E: avnd_main_process() (main.cc:616) ==428==by 0x1164FE: main (main.cc:206) -Original Message- From: A V MaheshOrganization: Oracle Corporation Date: Friday, 10 March 2017 at 6:42 pm To: gary , , , Cc: Subject: Re: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1 Hi Gary, Thanks for the initial inputs. The patch doesn't contain any in-service /backward compatible change , just wondering how this patch broken the legacy Application , can you please code-snippet of your legacy Application, that breaking the patch. -AVM On 3/10/2017 10:59 AM, Gary Lee wrote: > Hi Mahesh > > Some of our legacy tests are failing after applying this series. > > I will do some debugging and send back details. > > Thanks > Gary > > -Original Message- > From: A V Mahesh > Date: Wednesday, 8 March 2017 at 11:28 pm > To: , gary , , > Cc: > Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1 > > Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 > Review request for Trac Ticket(s): #2341 > Peer Reviewer(s): Amf Dev > Pull request to: <> > Affected branch(es): default, 5.2 > Development branch: default >
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Gary, One of the possibility of patch breaking the legacy Application is following change, try to rollback this change and see: === diff --git a/src/amf/agent/ava_op.cc b/src/amf/agent/ava_op.cc --- a/src/amf/agent/ava_op.cc +++ b/src/amf/agent/ava_op.cc @@ -117,7 +117,6 @@ uint32_t ava_avnd_msg_prc(AVA_CB *cb, AV **/ bool ava_B4_ver_used(AVA_CB *in_cb) { - AVA_CB *cb = 0; bool rc = false; if(in_cb) { @@ -125,8 +124,7 @@ bool ava_B4_ver_used(AVA_CB *in_cb) rc = true; } else { - - cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl); + AVA_CB *cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl); if(cb) { if((cb->version.releaseCode == 'B') && (cb->version.majorVersion == 0x04)) @@ -219,7 +217,7 @@ void amf_copy_from_SaAmfCallbacksT_4_to_ osaf_cbk->saAmfProxiedComponentInstantiateCallback = cbk->saAmfProxiedComponentInstantiateCallback; osaf_cbk->saAmfProxiedComponentCleanupCallback = cbk->saAmfProxiedComponentCleanupCallback; osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; + osaf_cbk->saAmfContainedComponentCleanupCallback = cbk->saAmfContainedComponentCleanupCallback; } /* @@ -238,7 +236,6 @@ void amf_copy_from_SaAmfCallbacksT_o4_to osaf_cbk->saAmfProxiedComponentInstantiateCallback = cbk->saAmfProxiedComponentInstantiateCallback; osaf_cbk->saAmfProxiedComponentCleanupCallback = cbk->saAmfProxiedComponentCleanupCallback; osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->osafCsiAttributeChangeCallback = cbk->osafCsiAttributeChangeCallback; + osaf_cbk->saAmfContainedComponentCleanupCallback = cbk->saAmfContainedComponentCleanupCallback; + osaf_cbk->osafCsiAttributeChangeCallback = cbk->osafCsiAttributeChangeCallback; } === -AVM On 3/10/2017 1:12 PM, A V Mahesh wrote: > Hi Gary, > > Thanks for the initial inputs. > > The patch doesn't contain any in-service /backward compatible change , > just wondering > how this patch broken the legacy Application , can you please > code-snippet of your legacy Application, > that breaking the patch. > > -AVM > > On 3/10/2017 10:59 AM, Gary Lee wrote: >> Hi Mahesh >> >> Some of our legacy tests are failing after applying this series. >> >> I will do some debugging and send back details. >> >> Thanks >> Gary >> >> -Original Message- >> From: A V Mahesh>> Date: Wednesday, 8 March 2017 at 11:28 pm >> To: , gary , >> , >> Cc: >> Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues >> [#2341] V1 >> >> Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 >> Review request for Trac Ticket(s): #2341 >> Peer Reviewer(s): Amf Dev >> Pull request to: <> >> Affected branch(es): default, 5.2 >> Development branch: default >> >> >> Impacted area Impact y/n >> >>Docsn >>Build systemn >>RPM/packaging n >>Configuration files n >>Startup scripts n >>SAF servicesn >>OpenSAF servicesy >>Core libraries n >>Samples n >>Tests n >>Other n >> >> >> Comments (indicate scope for each "y" above): >> - >> >> changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a >> Author:A V Mahesh >> Date: Wed, 08 Mar 2017 17:52:21 +0530 >> >> amfd: Fix all Cppcheck 1.77 issues [#2341] V1 >> >> [staging/src/amf/amfd/app.cc:285]: (style) The scope of the >> variable 'i' can >> be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) >> Condition 'rc!=0' >> is always false [staging/src/amf/amfd/apptype.cc:69]: (style) >> The scope of >> the variable
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Gary, Thanks for the initial inputs. The patch doesn't contain any in-service /backward compatible change , just wondering how this patch broken the legacy Application , can you please code-snippet of your legacy Application, that breaking the patch. -AVM On 3/10/2017 10:59 AM, Gary Lee wrote: > Hi Mahesh > > Some of our legacy tests are failing after applying this series. > > I will do some debugging and send back details. > > Thanks > Gary > > -Original Message- > From: A V Mahesh> Date: Wednesday, 8 March 2017 at 11:28 pm > To: , gary , > , > Cc: > Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues > [#2341] V1 > > Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 > Review request for Trac Ticket(s): #2341 > Peer Reviewer(s): Amf Dev > Pull request to: <> > Affected branch(es): default, 5.2 > Development branch: default > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesn > OpenSAF servicesy > Core libraries n > Samples n > Tests n > Other n > > > Comments (indicate scope for each "y" above): > - > > changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a > Author: A V Mahesh > Date:Wed, 08 Mar 2017 17:52:21 +0530 > > amfd: Fix all Cppcheck 1.77 issues [#2341] V1 > > [staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable > 'i' can > be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) Condition > 'rc!=0' > is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The scope > of > the variable 'sg_type' can be reduced. > [staging/src/amf/amfd/chkop.cc:1297] > -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_dec.cc:374] -> > [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_dec.cc:573] -> > [staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_edu.cc:51] -> > [staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable 'rc' is > reassigned a > value before the old one has been used. > [staging/src/amf/amfd/ckpt_enc.cc:2281] -> > [staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_enc.cc:2314] -> > [staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is > reassigned a value before the old one has been used. > [staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:1982]: > (performance) Prefer prefix ++/-- operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2044]: > (performance) Prefer prefix ++/-- operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2111]: > (performance) Prefer prefix ++/-- operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2176]: > (performance) Prefer prefix ++/-- operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2216]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2252]: > (performance) Prefer prefix ++/-- operators for non-primitive types. > [staging/src/amf/amfd/ckpt_enc.cc:2470]: (performance) Prefer prefix > ++/-- > operators for non-primitive types. [staging/src/amf/amfd/clm.cc:344]: > (performance) Prefer prefix ++/-- operators for non-primitive types. >
Re: [devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1
Hi Mahesh Some of our legacy tests are failing after applying this series. I will do some debugging and send back details. Thanks Gary -Original Message- From: A V MaheshDate: Wednesday, 8 March 2017 at 11:28 pm To: , gary , , Cc: Subject: [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1 Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 Review request for Trac Ticket(s): #2341 Peer Reviewer(s): Amf Dev Pull request to: <> Affected branch(es): default, 5.2 Development branch: default Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a Author: A V Mahesh Date: Wed, 08 Mar 2017 17:52:21 +0530 amfd: Fix all Cppcheck 1.77 issues [#2341] V1 [staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 'i' can be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) Condition 'rc!=0' is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The scope of the variable 'sg_type' can be reduced. [staging/src/amf/amfd/chkop.cc:1297] -> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:374] -> [staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:573] -> [staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_edu.cc:51] -> [staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_enc.cc:2281] -> [staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_enc.cc:2314] -> [staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is reassigned a value before the old one has been used. [staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:1982]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2044]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2111]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2176]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2216]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2252]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/ckpt_enc.cc:2470]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/clm.cc:344]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/cluster.cc:82]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/cluster.cc:95]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/cluster.cc:116]: (performance) Prefer prefix ++/-- operators for non-primitive types. [staging/src/amf/amfd/comp.cc:1270] -> [staging/src/amf/amfd/comp.cc:1285]: (style) Variable