Re: [devel] [PATCH 1 of 1] base: synchronize timer thread with the main thread [#2248]
Hi! I don't understand this patch. To me it looks like both the timer thread and the main thread will be waiting on the same selection object (gl_tcb.sel_obj). Shouldn't a separate selection object be used to synchronize thread start-up, to avoid a race here? Secondly, I don't understand why we need this synchronization in the first place. Shouldn't the timer functions work no matter if the timer thread is running or not? Of course, no timer will expire until the timer thread has started, but it should be possible to create timers regardless of whether the thread is running or not. regards, Anders Widell On 01/03/2017 04:42 PM, Zoran Milinkovic wrote: > src/base/sysf_tmr.c | 16 > 1 files changed, 16 insertions(+), 0 deletions(-) > > > sysfTmrCreate() will wait for max 1 second for the timer thread to be fully > ready to start timers. > > diff --git a/src/base/sysf_tmr.c b/src/base/sysf_tmr.c > --- a/src/base/sysf_tmr.c > +++ b/src/base/sysf_tmr.c > @@ -402,6 +402,10 @@ static uint32_t ncs_tmr_wait(void) > > ts_current = ts_start; > > + /* Send the first indication to the selection object > + * to synchronize threads */ > + m_NCS_SEL_OBJ_IND(&gl_tcb.sel_obj); > + > while (true) { > set.fd = m_GET_FD_FROM_SEL_OBJ(gl_tcb.sel_obj); > set.events = POLLIN; > @@ -526,6 +530,18 @@ bool sysfTmrCreate(void) > m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj); > return false; > } > + > + /* Wait for max 1 sec for ncs_tmr_wait() to be fully ready. > + * The function fails if the timer thread is not ready within 1 sec */ > + rc = osaf_poll_one_fd(gl_tcb.sel_obj.rmv_obj, 1000); > + if(rc != 1) { > + m_NCS_TASK_RELEASE(gl_tcb.p_tsk_hdl); > + ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree); > + m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj); > + return false; > + } > + m_NCS_SEL_OBJ_RMV_IND(&gl_tcb.sel_obj, true, true); > + > return true; > } > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Opensaf-devel mailing list > Opensaf-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensaf-devel > -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] base: fix decrementing reference counter in ncs_tmr_start and ncs_tmr_remaining [#2249]
Hi! To me, it looks like the object gl_tcb.persist and all functions accessing it (ncslpg_create, ncslpg_take, ncslpg_give) is just dead code. Can we just remove it? regards, Anders Widell On 01/04/2017 10:48 AM, Zoran Milinkovic wrote: > src/base/sysf_tmr.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > > Add missing decrementing reference counter 'gl_tcb.persist' in > ncs_tmr_start() and ncs_tmr_remaining() > > diff --git a/src/base/sysf_tmr.c b/src/base/sysf_tmr.c > --- a/src/base/sysf_tmr.c > +++ b/src/base/sysf_tmr.c > @@ -720,6 +720,7 @@ tmr_t ncs_tmr_start(tmr_t tid, int64_t t > if (rc == NCSCC_RC_FAILURE) { > /* Free the timer created */ > m_NCS_UNLOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE); > + ncslpg_give(&gl_tcb.persist, 0); > return NULL; > } > #if ENABLE_SYSLOG_TMR_STATS > @@ -735,6 +736,7 @@ tmr_t ncs_tmr_start(tmr_t tid, int64_t t > /* We would never reach here! */ > m_NCS_UNLOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE); > m_LEAP_DBG_SINK_VOID; > + ncslpg_give(&gl_tcb.persist, 0); > return NULL; > } > } > @@ -904,6 +906,7 @@ int64_t ncs_tmr_remaining(tmr_t tmrID, i > m_NCS_LOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE);/* critical > region START */ > if (!TMR_TEST_STATE(tmr, TMR_STATE_START)) { > m_NCS_UNLOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE); /* > critical region START */ > + ncslpg_give(&gl_tcb.persist, 0); > return NCSCC_RC_FAILURE; > } > m_NCS_UNLOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE); /* critical > region START */ > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Opensaf-devel mailing list > Opensaf-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensaf-devel > -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] base: fix memory leak and timer state in sysf_tmr.c [#2251]
Ack with comments inline, marked AndersW> regards, Anders Widell On 01/04/2017 03:28 PM, Zoran Milinkovic wrote: > src/base/sysf_tmr.c | 9 - > 1 files changed, 8 insertions(+), 1 deletions(-) > > > Fix memory leak in ncs_tmr_add_pat_node() > Fix timer state, so that the timer will not execute if ncs_tmr_start() fails > > diff --git a/src/base/sysf_tmr.c b/src/base/sysf_tmr.c > --- a/src/base/sysf_tmr.c > +++ b/src/base/sysf_tmr.c > @@ -180,6 +180,7 @@ static struct timespec ts_start; > static uint32_t ncs_tmr_add_pat_node(SYSF_TMR *tmr) > { > SYSF_TMR_PAT_NODE *temp_tmr_pat_node = NULL; > + int rc; AndersW> should be "unsigned int" to match the return type of ncs_patricia_tree_add() > > temp_tmr_pat_node = (SYSF_TMR_PAT_NODE > *)ncs_patricia_tree_get(&gl_tcb.tmr_pat_tree, (uint8_t *)&tmr->key); > > @@ -190,7 +191,11 @@ static uint32_t ncs_tmr_add_pat_node(SYS > memset(temp_tmr_pat_node, '\0', sizeof(SYSF_TMR_PAT_NODE)); > temp_tmr_pat_node->key = tmr->key; > temp_tmr_pat_node->pat_node.key_info = (uint8_t > *)&temp_tmr_pat_node->key; > - ncs_patricia_tree_add(&gl_tcb.tmr_pat_tree, (NCS_PATRICIA_NODE > *)&temp_tmr_pat_node->pat_node); > + rc = ncs_patricia_tree_add(&gl_tcb.tmr_pat_tree, > (NCS_PATRICIA_NODE *)&temp_tmr_pat_node->pat_node); > + if(rc != NCSCC_RC_SUCCESS) { > + m_NCS_MEM_FREE(temp_tmr_pat_node, > NCS_MEM_REGION_PERSISTENT, NCS_SERVICE_ID_LEAP_TMR, 0); > + return NCSCC_RC_FAILURE; > + } > } > > if (temp_tmr_pat_node->tmr_list_start == NULL) { > @@ -733,6 +738,8 @@ tmr_t ncs_tmr_start(tmr_t tid, int64_t t > on the "sel_obj". */ > if (m_NCS_SEL_OBJ_IND(&gl_tcb.sel_obj) != NCSCC_RC_SUCCESS) { > /* We would never reach here! */ > + /* Ignore this timer. Indication was not successfully > sent */ > + TMR_SET_STATE(tmr, TMR_STATE_DESTROY); AndersW> I think it is better to call osaf_abort() in this error case, since there must be some serious problem. Setting the timer state to TMR_STATE_DESTROY could be dangerous - doesn't that mean that the timer could be re-used by someone else? > m_NCS_UNLOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE); > m_LEAP_DBG_SINK_VOID; > return NULL; > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Opensaf-devel mailing list > Opensaf-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensaf-devel > -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1 of 1] ckpt: fix extended name issues in the library [#2128]
src/ckpt/agent/cpa_api.c | 26 +++--- src/ckpt/ckptnd/cpnd_evt.c | 12 2 files changed, 19 insertions(+), 19 deletions(-) Fix string temination issues when SaNameT value is provided to saCkptCheckpointOpen(), saCkptCheckpointOpenAsync() and saCkptCheckpointUnlink(). diff --git a/src/ckpt/agent/cpa_api.c b/src/ckpt/agent/cpa_api.c --- a/src/ckpt/agent/cpa_api.c +++ b/src/ckpt/agent/cpa_api.c @@ -871,13 +871,17 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH SaTimeT time_out=0; CPA_GLOBAL_CKPT_NODE *gc_node = NULL; SaConstStringT ckpt_name = NULL; + size_t ckpt_name_len; TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle); if ((checkpointName == NULL) || (checkpointHandle == NULL) || (osaf_extended_name_length(checkpointName) == 0)) { TRACE_4("Cpa CkptOpen Api failed with return value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle); TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM); return SA_AIS_ERR_INVALID_PARAM; - } else if (osaf_extended_name_length(checkpointName) > kOsafMaxDnLength) { + } + + ckpt_name_len = osaf_extended_name_length(checkpointName); + if (ckpt_name_len > kOsafMaxDnLength) { TRACE_4("Cpa CkptOpen Api failed with return value:%d,ckptHandle:%llx", SA_AIS_ERR_TOO_BIG, ckptHandle); TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_TOO_BIG); return SA_AIS_ERR_TOO_BIG; @@ -962,7 +966,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH lc_node->cl_hdl = ckptHandle; lc_node->open_flags = checkpointOpenFlags; - lc_node->ckpt_name = strdup(ckpt_name); + lc_node->ckpt_name = strndup(ckpt_name, ckpt_name_len); /* Add CPA_LOCAL_CKPT_NODE to lcl_ckpt_hdl_tree */ proc_rc = cpa_lcl_ckpt_node_add(&cb->lcl_ckpt_tree, lc_node); @@ -981,7 +985,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH evt.info.cpnd.info.openReq.client_hdl = ckptHandle; evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl; - osaf_extended_name_lend(ckpt_name, &evt.info.cpnd.info.openReq.ckpt_name); + osaf_extended_name_lend(lc_node->ckpt_name, &evt.info.cpnd.info.openReq.ckpt_name); if (checkpointCreationAttributes) { evt.info.cpnd.info.openReq.ckpt_attrib = *checkpointCreationAttributes; @@ -1178,6 +1182,7 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa CPA_CLIENT_NODE *cl_node = NULL; uint32_t proc_rc = NCSCC_RC_SUCCESS; SaConstStringT ckpt_name = NULL; + size_t ckpt_name_len; TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle); @@ -1185,7 +1190,10 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa TRACE_4("cpa CkptOpenAsync Api failed with return value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle); TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM); return SA_AIS_ERR_INVALID_PARAM; - } else if (osaf_extended_name_length(checkpointName) > kOsafMaxDnLength) { + } + + ckpt_name_len = osaf_extended_name_length(checkpointName); + if (ckpt_name_len > kOsafMaxDnLength) { TRACE_4("Cpa CkptOpenAsync Api failed with return value:%d,ckptHandle:%llx", SA_AIS_ERR_TOO_BIG, ckptHandle); TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_TOO_BIG); return SA_AIS_ERR_TOO_BIG; @@ -1262,7 +1270,7 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa lc_node->lcl_ckpt_hdl = NCS_PTR_TO_UNS64_CAST(lc_node); lc_node->cl_hdl = ckptHandle; lc_node->open_flags = checkpointOpenFlags; - lc_node->ckpt_name = strdup(ckpt_name); + lc_node->ckpt_name = strndup(ckpt_name, ckpt_name_len); /* Add CPA_LOCAL_CKPT_NODE to lcl_ckpt_hdl_tree */ proc_rc = cpa_lcl_ckpt_node_add(&cb->lcl_ckpt_tree, lc_node); @@ -1281,7 +1289,7 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa evt.info.cpnd.info.openReq.client_hdl = ckptHandle; evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl; - osaf_extended_name_lend(ckpt_name, &evt.info.cpnd.info.openReq.ckpt_name); + osaf_extended_name_lend(lc_node->ckpt_name, &evt.info.cpnd.info.openReq.ckpt_name); if (checkpointCreationAttributes) { evt.info.cpnd.info.openReq.ckpt_attrib = *checkpointCreationAttributes; @@ -1585,7 +1593,6 @@ SaAisErrorT saCkptCheckpointUnlink(SaCkp uint32_t proc_rc = NCSCC_RC_SUCCESS; CPA_CLIENT_NODE *cl_node = NULL; CPA_CB *cb = NULL; - SaConstStringT ckpt_name = NULL; TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle); /* For unlink CPA will not perform any operation other than passing @@ -1600,8 +1607,6 @@ SaAisErrorT saCkptCheckpointUnlink(SaCkp return SA_AIS_ERR_TOO_BIG
[devel] [PATCH 0 of 1] Review Request for ckpt: fix extended name issues in the library [#2128]
Summary: ckpt: fix extended name issues in the library [#2128] Review request for Trac Ticket(s): 2128 Peer Reviewer(s): Mahesh, Vu Pull request to: Zoran Affected branch(es): opensaf-5.1.x, default(5.2) Development branch: default(5.2) Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset 5139bc63f580d9b3dcc6e9caeefaf3bbfa4c7292 Author: Zoran Milinkovic Date: Tue, 10 Jan 2017 16:21:56 +0100 ckpt: fix extended name issues in the library [#2128] Fix string temination issues when SaNameT value is provided to saCkptCheckpointOpen(), saCkptCheckpointOpenAsync() and saCkptCheckpointUnlink(). Complete diffstat: -- src/ckpt/agent/cpa_api.c | 26 +++--- src/ckpt/ckptnd/cpnd_evt.c | 12 2 files changed, 19 insertions(+), 19 deletions(-) Testing Commands: - Testing, Expected Results: -- Test affected functions with checkpoint names that are not nil-terminated Conditions of Submission: - Ack from Mahesh and Vu Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1 of 1] ckpt: fix memory leak in cpd_a2s_ckpt_usr_info [#2257]
src/ckpt/ckptd/cpd_red.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) Fix memory leak in cpd_a2s_ckpt_usr_info() in cpd_red.c diff --git a/src/ckpt/ckptd/cpd_red.c b/src/ckpt/ckptd/cpd_red.c --- a/src/ckpt/ckptd/cpd_red.c +++ b/src/ckpt/ckptd/cpd_red.c @@ -339,5 +339,8 @@ void cpd_a2s_ckpt_usr_info(CPD_CB *cb, C TRACE_4("cpd A2S ckpt user info async update failed"); else TRACE_1("cpd A2S ckpt user info async update success"); + + free(cpd_msg.info.usr_info_2.node_list); + TRACE_LEAVE(); } -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0 of 1] Review Request for ckpt: fix memory leak in cpd_a2s_ckpt_usr_info [#2257]
Summary: ckpt: fix memory leak in cpd_a2s_ckpt_usr_info [#2257] Review request for Trac Ticket(s): 2257 Peer Reviewer(s): Mahesh, Vu Pull request to: Zoran Affected branch(es): opensaf-5.0.x, opensaf-5.1.x, default(5.2) Development branch: default(5.2) Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset 38b9760aee947d41b2bc8760fa6f0f181f9621e5 Author: Zoran Milinkovic Date: Tue, 10 Jan 2017 16:44:32 +0100 ckpt: fix memory leak in cpd_a2s_ckpt_usr_info [#2257] Fix memory leak in cpd_a2s_ckpt_usr_info() in cpd_red.c Complete diffstat: -- src/ckpt/ckptd/cpd_red.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) Testing Commands: - Testing, Expected Results: -- Check with valgrind that osafckptd does not have the reported memory leak. Conditions of Submission: - Ack from Mahesh and Vu Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0 of 1] Review Request for ckpt: fix memory leak in saCkptCheckpointRead [#2256]
Summary: ckpt: fix memory leak in saCkptCheckpointRead [#2256] Review request for Trac Ticket(s): 2256 Peer Reviewer(s): Mahesh, Vu Pull request to: Zoran Affected branch(es): opensaf-5.0.x, opensaf-5.1.x, default(5.2) Development branch: default(5.2) Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset eea7b196b146baa5fdf4e854a2f5ceab805daf95 Author: Zoran Milinkovic Date: Tue, 10 Jan 2017 17:24:59 +0100 ckpt: fix memory leak in saCkptCheckpointRead [#2256] Allocated memory in cpa_proc_build_data_access_evt() is freed. Complete diffstat: -- src/ckpt/agent/cpa_proc.c | 22 -- 1 files changed, 16 insertions(+), 6 deletions(-) Testing Commands: - Testing, Expected Results: -- Run ckpttest with valgrind and check that the reported memory leaks are gone Conditions of Submission: - Ack from Mahesh and Vu Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 n n powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1 of 1] ckpt: fix memory leak in saCkptCheckpointRead [#2256]
src/ckpt/agent/cpa_proc.c | 22 -- 1 files changed, 16 insertions(+), 6 deletions(-) Allocated memory in cpa_proc_build_data_access_evt() is freed. diff --git a/src/ckpt/agent/cpa_proc.c b/src/ckpt/agent/cpa_proc.c --- a/src/ckpt/agent/cpa_proc.c +++ b/src/ckpt/agent/cpa_proc.c @@ -1124,11 +1124,13 @@ uint32_t cpa_proc_build_data_access_evt( SaSizeT maxSectionSize, SaUint32T *errflag, CPSV_CKPT_DATA **ckpt_data) { CPSV_CKPT_DATA *tmp_ckpt_data = NULL; + *ckpt_data = NULL; if (numberOfElements > 0) { while (numberOfElements > 0) { tmp_ckpt_data = m_MMGR_ALLOC_CPSV_CKPT_DATA; - if (tmp_ckpt_data == NULL) - return NCSCC_RC_FAILURE; + if (tmp_ckpt_data == NULL) { + goto free_mem; + } memset(tmp_ckpt_data, '\0', sizeof(CPSV_CKPT_DATA)); switch (data_access_type) { @@ -1150,7 +1152,7 @@ uint32_t cpa_proc_build_data_access_evt( ioVector[numberOfElements - 1].dataSize) > maxSectionSize) { if (errflag != NULL) *errflag = (numberOfElements - 1); - return NCSCC_RC_FAILURE; + goto free_mem; } else tmp_ckpt_data->dataSize = ioVector[numberOfElements - 1].dataSize; } @@ -1159,7 +1161,7 @@ uint32_t cpa_proc_build_data_access_evt( break; default: - return NCSCC_RC_FAILURE; + goto free_mem; } if (*ckpt_data == NULL) @@ -1171,9 +1173,17 @@ uint32_t cpa_proc_build_data_access_evt( numberOfElements--; } return NCSCC_RC_SUCCESS; - } else { - return NCSCC_RC_FAILURE; } + +free_mem: + free(tmp_ckpt_data); + while(*ckpt_data) { + tmp_ckpt_data = *ckpt_data; + *ckpt_data = tmp_ckpt_data->next; + m_MMGR_FREE_CPSV_CKPT_DATA(tmp_ckpt_data); + } + + return NCSCC_RC_FAILURE; } / -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] ckpt: fix memory leak in cpd_a2s_ckpt_usr_info [#2257]
Hi Zoran, ACK Not tested. -AVM On 1/10/2017 9:18 PM, Zoran Milinkovic wrote: > src/ckpt/ckptd/cpd_red.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > > Fix memory leak in cpd_a2s_ckpt_usr_info() in cpd_red.c > > diff --git a/src/ckpt/ckptd/cpd_red.c b/src/ckpt/ckptd/cpd_red.c > --- a/src/ckpt/ckptd/cpd_red.c > +++ b/src/ckpt/ckptd/cpd_red.c > @@ -339,5 +339,8 @@ void cpd_a2s_ckpt_usr_info(CPD_CB *cb, C > TRACE_4("cpd A2S ckpt user info async update failed"); > else > TRACE_1("cpd A2S ckpt user info async update success"); > + > + free(cpd_msg.info.usr_info_2.node_list); > + > TRACE_LEAVE(); > } -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] ckpt: fix memory leak in saCkptCheckpointRead [#2256]
Hi Zoran, ACK Not tested. -AVM On 1/10/2017 9:58 PM, Zoran Milinkovic wrote: > src/ckpt/agent/cpa_proc.c | 22 -- > 1 files changed, 16 insertions(+), 6 deletions(-) > > > Allocated memory in cpa_proc_build_data_access_evt() is freed. > > diff --git a/src/ckpt/agent/cpa_proc.c b/src/ckpt/agent/cpa_proc.c > --- a/src/ckpt/agent/cpa_proc.c > +++ b/src/ckpt/agent/cpa_proc.c > @@ -1124,11 +1124,13 @@ uint32_t cpa_proc_build_data_access_evt( >SaSizeT maxSectionSize, SaUint32T > *errflag, CPSV_CKPT_DATA **ckpt_data) > { > CPSV_CKPT_DATA *tmp_ckpt_data = NULL; > + *ckpt_data = NULL; > if (numberOfElements > 0) { > while (numberOfElements > 0) { > tmp_ckpt_data = m_MMGR_ALLOC_CPSV_CKPT_DATA; > - if (tmp_ckpt_data == NULL) > - return NCSCC_RC_FAILURE; > + if (tmp_ckpt_data == NULL) { > + goto free_mem; > + } > memset(tmp_ckpt_data, '\0', sizeof(CPSV_CKPT_DATA)); > > switch (data_access_type) { > @@ -1150,7 +1152,7 @@ uint32_t cpa_proc_build_data_access_evt( > ioVector[numberOfElements - > 1].dataSize) > maxSectionSize) { > if (errflag != NULL) > *errflag = > (numberOfElements - 1); > - return NCSCC_RC_FAILURE; > + goto free_mem; > } else > tmp_ckpt_data->dataSize = > ioVector[numberOfElements - 1].dataSize; > } > @@ -1159,7 +1161,7 @@ uint32_t cpa_proc_build_data_access_evt( > break; > > default: > - return NCSCC_RC_FAILURE; > + goto free_mem; > } > > if (*ckpt_data == NULL) > @@ -1171,9 +1173,17 @@ uint32_t cpa_proc_build_data_access_evt( > numberOfElements--; > } > return NCSCC_RC_SUCCESS; > - } else { > - return NCSCC_RC_FAILURE; > } > + > +free_mem: > + free(tmp_ckpt_data); > + while(*ckpt_data) { > + tmp_ckpt_data = *ckpt_data; > + *ckpt_data = tmp_ckpt_data->next; > + m_MMGR_FREE_CPSV_CKPT_DATA(tmp_ckpt_data); > + } > + > + return NCSCC_RC_FAILURE; > } > > > / -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel