You can subscribe to this list here.
| 2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(442) |
May
(1532) |
Jun
(148) |
Jul
(178) |
Aug
(165) |
Sep
(196) |
Oct
(265) |
Nov
(230) |
Dec
(312) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2014 |
Jan
(328) |
Feb
(254) |
Mar
(141) |
Apr
(378) |
May
(441) |
Jun
(374) |
Jul
(235) |
Aug
(349) |
Sep
(396) |
Oct
(238) |
Nov
(138) |
Dec
(109) |
| 2015 |
Jan
(86) |
Feb
(81) |
Mar
(250) |
Apr
(180) |
May
(159) |
Jun
(106) |
Jul
(211) |
Aug
(248) |
Sep
(516) |
Oct
(297) |
Nov
(194) |
Dec
(196) |
| 2016 |
Jan
(232) |
Feb
(328) |
Mar
(422) |
Apr
(244) |
May
(281) |
Jun
(210) |
Jul
(211) |
Aug
(563) |
Sep
(440) |
Oct
(317) |
Nov
(405) |
Dec
(224) |
| 2017 |
Jan
(207) |
Feb
(399) |
Mar
(373) |
Apr
(206) |
May
(213) |
Jun
(215) |
Jul
(81) |
Aug
(151) |
Sep
(126) |
Oct
(336) |
Nov
(179) |
Dec
(149) |
| 2018 |
Jan
(194) |
Feb
(118) |
Mar
(234) |
Apr
(190) |
May
(103) |
Jun
(100) |
Jul
(162) |
Aug
(139) |
Sep
(140) |
Oct
(140) |
Nov
(181) |
Dec
(54) |
| 2019 |
Jan
(94) |
Feb
(76) |
Mar
(49) |
Apr
(46) |
May
(52) |
Jun
(79) |
Jul
(43) |
Aug
(97) |
Sep
(88) |
Oct
(138) |
Nov
(104) |
Dec
(66) |
| 2020 |
Jan
(85) |
Feb
(107) |
Mar
(68) |
Apr
(61) |
May
(52) |
Jun
(23) |
Jul
(118) |
Aug
(67) |
Sep
(27) |
Oct
(33) |
Nov
(41) |
Dec
(24) |
| 2021 |
Jan
(19) |
Feb
(11) |
Mar
(47) |
Apr
(39) |
May
(51) |
Jun
(18) |
Jul
(19) |
Aug
(16) |
Sep
(35) |
Oct
(15) |
Nov
(10) |
Dec
(21) |
| 2022 |
Jan
(12) |
Feb
(11) |
Mar
(30) |
Apr
(6) |
May
(10) |
Jun
(12) |
Jul
(13) |
Aug
(10) |
Sep
(3) |
Oct
(4) |
Nov
(24) |
Dec
(25) |
| 2023 |
Jan
(3) |
Feb
(3) |
Mar
(11) |
Apr
(8) |
May
(2) |
Jun
|
Jul
(4) |
Aug
(5) |
Sep
(2) |
Oct
|
Nov
|
Dec
(2) |
| 2024 |
Jan
(9) |
Feb
(1) |
Mar
(2) |
Apr
(8) |
May
(8) |
Jun
(5) |
Jul
(6) |
Aug
(3) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
(4) |
Jun
(3) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(1) |
Nov
(4) |
Dec
|
|
From: Thien H. <thi...@en...> - 2025-11-17 12:15:33
|
During network merge or split-brain recovery, IMM may be busy in the sync
phase and drop the set-implementer message. This causes imm agent to timeout
and later fail with SA_AIS_ERR_EXIST even after restart.
In case IMMND does not get a response from IMMD, or sending the response to
the agent fails, assume an implementer issue and allow the IMM agent to set
the implementer again.
---
src/imm/immnd/ImmModel.cc | 6 +-
src/imm/immnd/immnd_cb.h | 9 +++
src/imm/immnd/immnd_db.c | 119 +++++++++++++++++++++++++++++++++++++
src/imm/immnd/immnd_evt.c | 43 ++++++++++++--
src/imm/immnd/immnd_init.h | 7 ++-
5 files changed, 176 insertions(+), 8 deletions(-)
diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index d0add57d8..d04107e22 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -1777,8 +1777,9 @@ SaAisErrorT immModel_implementerSet(IMMND_CB* cb,
}
SaAisErrorT immModel_implIsFree(IMMND_CB* cb, const IMMSV_OI_IMPLSET_REQ* req,
- SaUint32T* impl_id) {
+ SaUint32T* impl_id, bool* is_owner) {
*impl_id = 0;
+ *is_owner=false;
SaImmOiImplementerNameT impName = req->impl_name.buf;
std::string implName(impName);
if (implName.empty()) {
@@ -1803,8 +1804,9 @@ SaAisErrorT immModel_implIsFree(IMMND_CB* cb, const IMMSV_OI_IMPLSET_REQ* req,
/* Check for redundant request that comes from previously timed out client */
if (impl->mConn == m_IMMSV_UNPACK_HANDLE_HIGH(req->client_hdl) &&
impl->mNodeId == m_IMMSV_UNPACK_HANDLE_LOW(req->client_hdl)) {
- *impl_id = impl->mId;
+ *is_owner = true;
}
+ *impl_id = impl->mId;
return SA_AIS_ERR_EXIST;
}
diff --git a/src/imm/immnd/immnd_cb.h b/src/imm/immnd/immnd_cb.h
index 85e3663ca..20853548d 100644
--- a/src/imm/immnd/immnd_cb.h
+++ b/src/imm/immnd/immnd_cb.h
@@ -93,6 +93,13 @@ typedef struct immnd_fevs_msg_node {
struct immnd_fevs_msg_node *next;
} IMMND_FEVS_MSG_NODE;
+typedef struct immnd_impl_reply_pending {
+ char *buf;
+ SaUint32T size;
+ struct immnd_impl_reply_pending *next;
+} IMMND_IMPL_REPLY_PENDING;
+
+
/*****************************************************************************
* Data Structure used to hold IMMND control block
*****************************************************************************/
@@ -211,6 +218,8 @@ typedef struct immnd_cb_tag {
bool splitbrain_tmr_run;
uint8_t mFevsMaxPending; /* Max pending fevs messages towards director */
bool mSyncrTimeout;
+ IMMND_IMPL_REPLY_PENDING *impl_reply_pendings;
+ IMMND_IMPL_REPLY_PENDING *last_pendings;
} IMMND_CB;
/* CB prototypes */
diff --git a/src/imm/immnd/immnd_db.c b/src/imm/immnd/immnd_db.c
index 13009054b..d7b36a919 100644
--- a/src/imm/immnd/immnd_db.c
+++ b/src/imm/immnd/immnd_db.c
@@ -388,3 +388,122 @@ unsigned int immnd_dequeue_outgoing_fevs_msg(IMMND_CB *cb,
return cb->fevs_out_count;
}
+
+/***************************************************************************
+ * Name : immnd_implementer_pending_equal
+ *
+ * Description : Compare a node's (size, buf) with a given payload.
+ *
+ ***************************************************************************/
+inline bool immnd_implementer_pending_equal(const IMMND_IMPL_REPLY_PENDING *n,
+ const char *buf, SaUint32T size)
+{
+ if (!n || !buf)
+ return false;
+ return (n->size == size) && (memcmp(n->buf, buf, size) == 0);
+}
+
+/***************************************************************************
+ * Name : immnd_implementer_pending_exists
+ *
+ * Description : Check if implementer name entry exists in the global list.
+ *
+ ***************************************************************************/
+bool immnd_implementer_pending_exists(IMMND_CB *cb, IMMSV_OCTET_STRING *msg)
+{
+ for (IMMND_IMPL_REPLY_PENDING *n = cb->impl_reply_pendings; n;
+ n = n->next) {
+ if (immnd_implementer_pending_equal(n, msg->buf, msg->size))
+ return true;
+ }
+ return false;
+}
+
+/***************************************************************************
+ * Name : immnd_implementer_pending_add
+ *
+ * Description : Add a unique implementer name entry to the tail of
+ * the global list. Returns false if the entry already
+ * exists or OOM.
+ *
+ ***************************************************************************/
+bool immnd_implementer_pending_add(IMMND_CB *cb, IMMSV_OCTET_STRING *msg)
+{
+ if (immnd_implementer_pending_exists(cb, msg))
+ return false;
+
+ IMMND_IMPL_REPLY_PENDING *node = calloc(1, sizeof *node);
+ if (!node)
+ return false;
+
+ char *copy = strdup((const char *)msg->buf);
+ if (!copy)
+ return false;
+
+ node->buf = copy;
+ node->size = msg->size;
+ node->next = NULL;
+
+ if (!cb->impl_reply_pendings) {
+ cb->impl_reply_pendings = node;
+ cb->last_pendings = node;
+ } else {
+ cb->last_pendings->next = node;
+ cb->last_pendings = node;
+ }
+ return true;
+}
+
+/***************************************************************************
+ * Name : immnd_implementer_pending_remove
+ *
+ * Description : Remove the first entry equal to implementer name from the
+ * global list. Frees the node and payload on success.
+ *
+ ***************************************************************************/
+bool immnd_implementer_pending_remove(IMMND_CB *cb, IMMSV_OCTET_STRING *msg)
+{
+ IMMND_IMPL_REPLY_PENDING *prev = NULL;
+ IMMND_IMPL_REPLY_PENDING *cur = cb->impl_reply_pendings;
+
+ while (cur) {
+ if (immnd_implementer_pending_equal(cur, msg->buf,
+ msg->size)) {
+ IMMND_IMPL_REPLY_PENDING *next = cur->next;
+ if (prev)
+ prev->next = next;
+ else
+ cb->impl_reply_pendings = next;
+
+ if (cb->last_pendings == cur)
+ cb->last_pendings = prev;
+
+ free(cur->buf);
+ free(cur);
+ return true;
+ }
+ prev = cur;
+ cur = cur->next;
+ }
+ return false;
+}
+
+/***************************************************************************
+ * Name : immnd_implementer_pending_cleanup
+ *
+ * Description : Remove and free all entries from the global list
+ * (head and tail are reset to NULL).
+ *
+ ***************************************************************************/
+void immnd_implementer_pending_cleanup(IMMND_CB *cb)
+{
+ IMMND_IMPL_REPLY_PENDING *n = cb->impl_reply_pendings;
+ while (n) {
+ IMMND_IMPL_REPLY_PENDING *next = n->next;
+ free(n->buf);
+ free(n);
+ n = next;
+ }
+ cb->impl_reply_pendings = NULL;
+ cb->last_pendings = NULL;
+}
diff --git a/src/imm/immnd/immnd_evt.c b/src/imm/immnd/immnd_evt.c
index 46cb85b31..c1ea42220 100644
--- a/src/imm/immnd/immnd_evt.c
+++ b/src/imm/immnd/immnd_evt.c
@@ -2950,15 +2950,34 @@ static uint32_t immnd_evt_proc_impl_set(IMMND_CB *cb, IMMND_EVT *evt,
See finalizeSync #1871.
*/
SaUint32T impl_id;
+ bool is_owner = false;
send_evt.info.imma.info.implSetRsp.error =
- immModel_implIsFree(cb, &evt->info.implSet, &impl_id);
+ immModel_implIsFree(cb, &evt->info.implSet, &impl_id, &is_owner);
if (send_evt.info.imma.info.implSetRsp.error != SA_AIS_OK) {
- if (impl_id && send_evt.info.imma.info.implSetRsp.error ==
- SA_AIS_ERR_EXIST) {
+ if (is_owner && send_evt.info.imma.info.implSetRsp.error ==
+ SA_AIS_ERR_EXIST) {
/* Immediately respond OK to agent */
send_evt.info.imma.info.implSetRsp.error = SA_AIS_OK;
send_evt.info.imma.info.implSetRsp.implId = impl_id;
+ } else if (immnd_implementer_pending_exists(
+ cb, &(evt->info.implSet.impl_name))) {
+ TRACE_5("Discarding implementer id:%u", impl_id);
+ memset(&send_evt, '\0', sizeof(IMMSV_EVT));
+ send_evt.type = IMMSV_EVT_TYPE_IMMD;
+ send_evt.info.immd.type = IMMD_EVT_ND2D_DISCARD_IMPL;
+ send_evt.info.immd.info.impl_set.r.impl_id = impl_id;
+ if (immnd_mds_msg_send(cb, NCSMDS_SVC_ID_IMMD,
+ cb->immd_mdest_id, &send_evt) !=
+ NCSCC_RC_SUCCESS) {
+ LOG_ER("Discard implementer failed for "
+ "implId:%u. Client will be orphanded",
+ impl_id);
+ }
+ immModel_discardImplementer(cb, impl_id, false, NULL,
+ NULL);
+ send_evt.info.imma.info.implSetRsp.error =
+ SA_AIS_ERR_TRY_AGAIN;
}
goto agent_rsp;
}
@@ -3001,6 +3020,13 @@ static uint32_t immnd_evt_proc_impl_set(IMMND_CB *cb, IMMND_EVT *evt,
goto agent_rsp;
}
+ if (!immnd_implementer_pending_add(cb,
+ &(evt->info.implSet.impl_name))) {
+ TRACE("The implementer (%s) is already in the list of pending "
+ "replies.",
+ evt->info.implSet.impl_name.buf);
+ }
+
/*Save sinfo in continuation.
Note should set up a wait time for the continuation roughly in line
with IMMSV_WAIT_TIME.
@@ -11731,8 +11757,15 @@ static void immnd_evt_proc_impl_set_rsp(IMMND_CB *cb, IMMND_EVT *evt,
rc = immnd_mds_send_rsp(cb, &(cl_node->tmpSinfo), &send_evt);
if (rc != NCSCC_RC_SUCCESS) {
- LOG_WA(
- "Failed to send response to agent/client over MDS");
+ LOG_WA("Failed to send response to agent/client over "
+ "MDS");
+ } else {
+ if (!immnd_implementer_pending_remove(
+ cb, &(evt->info.implSet.impl_name))) {
+ LOG_WA("Failed to remove pending implementer "
+ "name: %s",
+ evt->info.implSet.impl_name.buf);
+ }
}
}
}
diff --git a/src/imm/immnd/immnd_init.h b/src/imm/immnd/immnd_init.h
index 704ea3ba9..80fb4a30d 100644
--- a/src/imm/immnd/immnd_init.h
+++ b/src/imm/immnd/immnd_init.h
@@ -472,7 +472,7 @@ void immModel_ccbAugmentAdmo(IMMND_CB *cb, SaUint32T adminOwnerId,
bool immModel_pbeNotWritable(IMMND_CB *cb);
SaAisErrorT immModel_implIsFree(IMMND_CB *cb, const IMMSV_OI_IMPLSET_REQ *req,
- SaUint32T *impl_id);
+ SaUint32T *impl_id, bool* is_owner);
SaAisErrorT immModel_resourceDisplay(
IMMND_CB *cb, const struct ImmsvAdminOperationParam *reqparams,
@@ -524,6 +524,11 @@ unsigned int immnd_enqueue_outgoing_fevs_msg(IMMND_CB *cb,
void dequeue_outgoing(IMMND_CB *cb);
+bool immnd_implementer_pending_exists(IMMND_CB *cb, IMMSV_OCTET_STRING *msg);
+bool immnd_implementer_pending_add(IMMND_CB *cb, IMMSV_OCTET_STRING *msg);
+bool immnd_implementer_pending_remove(IMMND_CB *cb, IMMSV_OCTET_STRING *msg);
+void immnd_implementer_pending_cleanup(IMMND_CB *cb);
+
/* End File : immnd_db.c */
/* File : --- immnd_mds.c */
--
2.34.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-11-17 12:15:08
|
Summary: imm: make the set implementer API more resilient [#3390] Review request for Ticket(s): 3390 Peer Reviewer(s): Thang, Tai Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3390 Base revision: 3958cc4b7f9853354020c8a30b3c0fff90ae4283 Personal repository: git://git.code.sf.net/u/thienhuynh/review -------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 4bdb0ad56f8ebc1029d0b2c36f3d21dccd08a12d Author: Thien Minh Huynh <thi...@en...> Date: Mon, 17 Nov 2025 11:56:40 +0000 imm: make the set implementer API more resilient [#3390] During network merge or split-brain recovery, IMM may be busy in the sync phase and drop the set-implementer message. This causes imm agent to timeout and later fail with SA_AIS_ERR_EXIST even after restart. In case IMMND does not get a response from IMMD, or sending the response to the agent fails, assume an implementer issue and allow the IMM agent to set the implementer again. Complete diffstat: ------------------ src/imm/immnd/ImmModel.cc | 6 ++- src/imm/immnd/immnd_cb.h | 9 ++++ src/imm/immnd/immnd_db.c | 119 +++++++++++++++++++++++++++++++++++++++++++++ src/imm/immnd/immnd_evt.c | 43 ++++++++++++++-- src/imm/immnd/immnd_init.h | 7 ++- 5 files changed, 176 insertions(+), 8 deletions(-) Testing Commands: ----------------- N/A Testing, Expected Results: -------------------------- N/A Conditions of Submission: ------------------------- ACK from reviewer Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 y y 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 ~/.gitconfig file (i.e. user.name, user.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. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-11-17 10:17:44
|
Hi Thang,
ACK from me.
Best Regards,
Thien
________________________________
From: Thang Nguyen <tha...@en...>
Sent: Monday, November 10, 2025 7:58 AM
To: Thien Huynh <thi...@en...>; Dat Phan <Dat...@en...>; Tai Nguyen <tai...@en...>
Cc: ope...@li... <ope...@li...>; Thang Nguyen <tha...@en...>
Subject: [PATCH 1/1] amf: correct role failover failed [#3383]
Currently role failover from standby to active
does not handle error return code correctly. It
causes there is no AMF-OI for AMF objects.
The fix is to correct handle the error return code
so that AMF can be recovered automatically.
---
src/amf/amfd/role.cc | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/amf/amfd/role.cc b/src/amf/amfd/role.cc
index f74bd689f..1d7e16303 100644
--- a/src/amf/amfd/role.cc
+++ b/src/amf/amfd/role.cc
@@ -454,8 +454,11 @@ static uint32_t avd_role_failover(AVD_CL_CB *cb, SaAmfHAStateT role) {
on Avd role. */
if (rc == SA_AIS_ERR_BAD_HANDLE) {
avd_imm_reinit_bg();
- } else
+ } else {
+ avd_d2d_chg_role_rsp(cb, NCSCC_RC_FAILURE, SA_AMF_HA_ACTIVE);
+ status = NCSCC_RC_FAILURE;
goto done;
+ }
}
/* Time to send fail-over messages to all the AVND's */
@@ -480,12 +483,11 @@ static uint32_t avd_role_failover(AVD_CL_CB *cb, SaAmfHAStateT role) {
LOG_ER("FAILOVER StandBy --> Active FAILED, ImplementerSet failed %u", rc);
if (rc == SA_AIS_ERR_BAD_HANDLE) {
avd_imm_reinit_bg();
- } else if (rc == SA_AIS_ERR_EXIST) {
- /* This may arise if immutil_saImmOiImplementerClear
- failed and amf reinitializes imm interface and
- set impl in avd_imm_reinit_bg_thread.*/
- } else
+ } else {
+ avd_d2d_chg_role_rsp(cb, NCSCC_RC_FAILURE, SA_AMF_HA_ACTIVE);
+ status = NCSCC_RC_FAILURE;
goto done;
+ }
} else
osaf_mutex_unlock_ordie(&imm_reinit_mutex);
--
2.48.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-11-04 08:23:30
|
Hi Thang,
ACK without comment.
Best Regards,
Thien
________________________________
From: Thang Nguyen <tha...@en...>
Sent: Wednesday, October 29, 2025 9:17 AM
To: Thien Huynh <thi...@en...>
Cc: ope...@li... <ope...@li...>; Thang Nguyen <tha...@en...>
Subject: [PATCH 1/1] amfd: correct rtObject create/delete/update [#3382]
AMFD attempts to create the rtObject. If unsuccessful,
it handles the creation via the queue. However, it does
not correctly handle the case when ERR_EXIST is returned.
In this scenario, the error should be ignored to prevent
the creation of duplicate SUSI records.
A similar issue NOT_EXIST with the delete/update operation
and should be corrected accordingly.
---
src/amf/amfd/imm.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index b2a17a10c..03b2b860b 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -1677,7 +1677,7 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sync(
attributeName, rc);
}
- if (rc != SA_AIS_OK) {
+ if (rc != SA_AIS_OK && rc != SA_AIS_ERR_NOT_EXIST) {
// Now it will be updated through job queue.
avd_saImmOiRtObjectUpdate(dn, attribute_name, attrValueType, value);
}
@@ -1843,7 +1843,7 @@ void avd_saImmOiRtObjectCreate_sync(const std::string &className,
}
}
- if (rc != SA_AIS_OK || isImmReady == false) {
+ if ((rc != SA_AIS_OK && rc != SA_AIS_ERR_EXIST) || isImmReady == false) {
// Now it will be updated through job queue.
avd_saImmOiRtObjectCreate(className, parentName, attrValues);
}
@@ -1895,7 +1895,7 @@ void avd_saImmOiRtObjectDelete_sync(const std::string &dn) {
LOG_WA("saImmOiRtObjectDelete_o3 of '%s' failed with %u", dn.c_str(), rc);
}
}
- if (rc != SA_AIS_OK || isImmReady == false) {
+ if ((rc != SA_AIS_OK && rc != SA_AIS_ERR_NOT_EXIST) || isImmReady == false) {
// Now it will be updated through job queue.
avd_saImmOiRtObjectDelete(dn);
}
--
2.48.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-10-31 07:20:35
|
Hi, Please help me review the OpenSAF_NTFSv_PR.odt. I have scaled the diagram to fit with document page. [cid:3074d0cc-1df2-4880-bfed-14c844d75e6a] Best Regards, Thien The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-09-10 08:56:45
|
Hi Khoa,
ACK from me.
Best Regards,
Thien
________________________________
From: Khoa Nguyen <kho...@en...>
Sent: Wednesday, September 10, 2025 1:48 PM
To: Thien Huynh <thi...@en...>; Thang Nguyen <tha...@en...>
Cc: ope...@li... <ope...@li...>; Khoa Nguyen <kho...@en...>
Subject: [PATCH 1/1] dtm: Fix coding issues identified by Codechecker [#3378]
---
src/dtm/dtmnd/dtm_intra.cc | 2 +-
src/dtm/dtmnd/dtm_intra_svc.cc | 30 +++++++++++++++---------------
src/dtm/dtmnd/dtm_main.cc | 2 +-
src/dtm/dtmnd/multicast.cc | 4 ++--
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/dtm/dtmnd/dtm_intra.cc b/src/dtm/dtmnd/dtm_intra.cc
index f592449a3..257583a7a 100644
--- a/src/dtm/dtmnd/dtm_intra.cc
+++ b/src/dtm/dtmnd/dtm_intra.cc
@@ -358,7 +358,7 @@ static uint32_t dtm_intranode_create_rcv_task(int task_hdl) {
int policy = SCHED_RR; /*root defaults */
int max_prio = sched_get_priority_max(policy);
int min_prio = sched_get_priority_min(policy);
- int prio_val = ((max_prio - min_prio) * 0.87);
+ int prio_val = static_cast<int>((max_prio - min_prio) * 0.87);
if (ncs_task_create(
dtm_intranode_processing, reinterpret_cast<NCSCONTEXT>(task_hdl),
diff --git a/src/dtm/dtmnd/dtm_intra_svc.cc b/src/dtm/dtmnd/dtm_intra_svc.cc
index 8e0474210..aaabcfd8e 100644
--- a/src/dtm/dtmnd/dtm_intra_svc.cc
+++ b/src/dtm/dtmnd/dtm_intra_svc.cc
@@ -195,7 +195,7 @@ uint32_t dtm_intranode_process_pid_down(int fd) {
dtm_intranode_get_svc_node(svc_list->server_type);
if (nullptr != svc_node) {
/* delete the entries */
- DTM_SVC_LIST list = {nullptr};
+ DTM_SVC_LIST list = {};
list.server_inst_lower = svc_list->server_instance_lower;
list.server_inst_higher = svc_list->server_instance_upper;
list.node_id = pid_node->node_id;
@@ -215,7 +215,7 @@ uint32_t dtm_intranode_process_pid_down(int fd) {
/* Subscriptions present send to all the
* processes in the local node */
uint8_t buffer[DTM_LIB_DOWN_MSG_SIZE_FULL];
- DTM_LIB_DOWN_MSG down_msg = {0};
+ DTM_LIB_DOWN_MSG down_msg = {};
subscr_list = subscr_node->subscriber_list;
down_msg.server_type = svc_list->server_type;
@@ -363,7 +363,7 @@ uint32_t dtm_intranode_process_bind_msg(uint8_t *buff, int fd) {
* the local node */
DTM_SUBSCRIBER_LIST *subscr_list = subscr_node->subscriber_list;
uint8_t buffer[DTM_LIB_UP_MSG_SIZE_FULL];
- DTM_LIB_UP_MSG up_msg = {0};
+ DTM_LIB_UP_MSG up_msg = {};
up_msg.server_type = svc_install_info->server_type;
up_msg.server_instance_lower = svc_install_info->server_instance_lower;
up_msg.server_instance_upper = svc_install_info->server_instance_upper;
@@ -406,8 +406,8 @@ uint32_t dtm_intranode_process_bind_msg(uint8_t *buff, int fd) {
*********************************************************/
uint32_t dtm_intranode_process_unbind_msg(uint8_t *buff, int fd) {
- DTM_PID_SVC_INSTALLED_INFO pid_svc_info = {nullptr};
- DTM_SVC_LIST svc_list = {nullptr};
+ DTM_PID_SVC_INSTALLED_INFO pid_svc_info = {};
+ DTM_SVC_LIST svc_list = {};
uint8_t *data = buff; /* Used for decoding */
TRACE_ENTER();
@@ -462,7 +462,7 @@ uint32_t dtm_intranode_process_unbind_msg(uint8_t *buff, int fd) {
* the local node */
DTM_SUBSCRIBER_LIST *subscr_list = subscr_node->subscriber_list;
uint8_t buffer[DTM_LIB_DOWN_MSG_SIZE_FULL];
- DTM_LIB_DOWN_MSG down_msg = {0};
+ DTM_LIB_DOWN_MSG down_msg = {};
down_msg.server_type = server_type;
down_msg.server_instance_lower = svc_list.server_inst_lower;
down_msg.server_instance_upper = svc_list.server_inst_lower;
@@ -588,7 +588,7 @@ uint32_t dtm_intranode_process_subscribe_msg(uint8_t *buff, int fd) {
} else {
uint8_t *buffer = nullptr;
- DTM_LIB_UP_MSG up_msg = {0};
+ DTM_LIB_UP_MSG up_msg = {};
if (nullptr == (buffer = static_cast<uint8_t *>(
calloc(1, DTM_LIB_UP_MSG_SIZE_FULL)))) {
@@ -706,7 +706,7 @@ uint32_t dtm_intranode_process_node_subscribe_msg(uint8_t *buff, int fd) {
dtm_add_to_node_subscr_list(node_subscr_info);
while (nullptr != node_db) {
- DTM_LIB_NODE_UP_MSG node_up_msg = {0};
+ DTM_LIB_NODE_UP_MSG node_up_msg = {};
uint8_t *buffer = nullptr;
if (nullptr == (buffer = static_cast<uint8_t *>(
calloc(1, DTM_LIB_NODE_UP_MSG_SIZE_FULL)))) {
@@ -1358,7 +1358,7 @@ static uint32_t dtm_internode_delete_svc_installed_list_from_svc_tree(
DTM_INTRANODE_NODE_DB *node) {
DTM_SVC_INSTALL_INFO *svc_info = nullptr;
DTM_SVC_LIST *svc_list = nullptr, *del_ptr = nullptr,
- local_svc_list = {nullptr};
+ local_svc_list = {};
uint32_t server_type = 0;
TRACE_ENTER();
@@ -1519,7 +1519,7 @@ uint32_t dtm_intranode_process_node_up(NODE_ID node_id, char *node_name,
} else {
/* Deliver node UP */
DTM_NODE_SUBSCR_INFO *node_subscr_info = dtm_node_subscr_list;
- DTM_LIB_NODE_UP_MSG node_up_msg = {0};
+ DTM_LIB_NODE_UP_MSG node_up_msg = {};
uint8_t buffer[DTM_LIB_NODE_UP_MSG_SIZE_FULL];
node_up_msg.node_id = node_id;
node_up_msg.i_addr_family = i_addr_family;
@@ -1563,7 +1563,7 @@ uint32_t dtm_intranode_process_node_up(NODE_ID node_id, char *node_name,
*********************************************************/
uint32_t dtm_intranode_process_node_down(NODE_ID node_id) {
DTM_NODE_SUBSCR_INFO *node_subscr_info = dtm_node_subscr_list;
- DTM_LIB_NODE_DOWN_MSG node_down_msg = {0};
+ DTM_LIB_NODE_DOWN_MSG node_down_msg = {};
uint8_t buffer[DTM_LIB_NODE_DOWN_MSG_SIZE_FULL];
/* Deliver svc down to all the subscribers of service present on this
@@ -1684,7 +1684,7 @@ static uint32_t dtm_intranode_process_svc_down_common(
/* Subscriptions present send to all the
* processes in the local node */
uint8_t buffer[DTM_LIB_DOWN_MSG_SIZE_FULL];
- DTM_LIB_DOWN_MSG down_msg = {0};
+ DTM_LIB_DOWN_MSG down_msg = {};
down_msg.server_type = server_type;
down_msg.server_instance_lower = svc_list->server_inst_lower;
down_msg.server_instance_upper = svc_list->server_inst_higher;
@@ -1850,7 +1850,7 @@ uint32_t dtm_process_internode_service_up_msg(uint8_t *buffer, uint16_t len,
* processes in the local node */
DTM_SUBSCRIBER_LIST *subscr_list = subscr_node->subscriber_list;
uint8_t local_buffer[DTM_LIB_UP_MSG_SIZE_FULL];
- DTM_LIB_UP_MSG up_msg = {0};
+ DTM_LIB_UP_MSG up_msg = {};
up_msg.server_type = svc_info->server_type;
up_msg.server_instance_lower = svc_list->server_inst_lower;
up_msg.server_instance_upper = svc_list->server_inst_higher;
@@ -1918,7 +1918,7 @@ uint32_t dtm_process_internode_service_down_msg(uint8_t *buffer, uint16_t len,
osafassert(0);
} else {
while (0 != num_of_elements) {
- DTM_SVC_LIST svc_list = {nullptr};
+ DTM_SVC_LIST svc_list = {};
DTM_SVC_SUBSCR_INFO *subscr_node = nullptr;
uint32_t server_type = ncs_decode_32bit(&data);
DTM_SVC_INSTALL_INFO *svc_info =
@@ -1956,7 +1956,7 @@ uint32_t dtm_process_internode_service_down_msg(uint8_t *buffer, uint16_t len,
* processes in the local node */
DTM_SUBSCRIBER_LIST *subscr_list = subscr_node->subscriber_list;
uint8_t local_buffer[DTM_LIB_DOWN_MSG_SIZE_FULL];
- DTM_LIB_DOWN_MSG down_msg = {0};
+ DTM_LIB_DOWN_MSG down_msg = {};
down_msg.server_type = server_type;
down_msg.server_instance_lower = svc_list.server_inst_lower;
down_msg.server_instance_upper = svc_list.server_inst_higher;
diff --git a/src/dtm/dtmnd/dtm_main.cc b/src/dtm/dtmnd/dtm_main.cc
index 46dd2e0ed..e1d140f90 100644
--- a/src/dtm/dtmnd/dtm_main.cc
+++ b/src/dtm/dtmnd/dtm_main.cc
@@ -172,7 +172,7 @@ uint32_t dtm_node_discovery_task_create() {
int policy = SCHED_RR; /*root defaults */
int max_prio = sched_get_priority_max(policy);
int min_prio = sched_get_priority_min(policy);
- int prio_val = ((max_prio - min_prio) * 0.87);
+ int prio_val = static_cast<int>((max_prio - min_prio) * 0.87);
uint32_t rc = ncs_task_create(
node_discovery_process, nullptr, "OSAF_NODE_DISCOVERY", prio_val, policy,
diff --git a/src/dtm/dtmnd/multicast.cc b/src/dtm/dtmnd/multicast.cc
index ed5079d08..0027f60ed 100644
--- a/src/dtm/dtmnd/multicast.cc
+++ b/src/dtm/dtmnd/multicast.cc
@@ -110,8 +110,8 @@ Multicast::Multicast(uint16_t cluster_id, uint32_t node_id,
dgram_sock_rcvr = -1;
}
- struct in_addr addr_ipv4;
- struct in6_addr addr_ipv6;
+ struct in_addr addr_ipv4{};
+ struct in6_addr addr_ipv6{};
int rc = -1;
if (address_family_ == AF_INET) {
rc = inet_pton(AF_INET, stream_address_.c_str(), &addr_ipv4);
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-09-04 08:35:58
|
Hi Khuong,
ACK from me.
Best Regards,
Thien
________________________________
From: Khuong Le <khu...@en...>
Sent: Wednesday, September 3, 2025 10:35 PM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Thang Nguyen <tha...@en...>; Tai Nguyen <tai...@en...>
Cc: ope...@li... <ope...@li...>; Khuong Le <khu...@en...>
Subject: [PATCH 1/1] ntf: Fix coding issues identified by CodeChecker [#3377]
---
src/ntf/common/ntfsv_enc_dec.c | 30 ++++++++++++++---------------
src/ntf/common/ntfsv_mem.c | 16 ++++++++--------
src/ntf/ntfd/NtfFilter.cc | 34 ++++++++++++++++-----------------
src/ntf/ntfd/NtfNotification.cc | 4 ++--
src/ntf/ntfd/ntfs_mbcsv.c | 4 ++--
5 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/src/ntf/common/ntfsv_enc_dec.c b/src/ntf/common/ntfsv_enc_dec.c
index 7a2d66d0a..02c71b243 100644
--- a/src/ntf/common/ntfsv_enc_dec.c
+++ b/src/ntf/common/ntfsv_enc_dec.c
@@ -38,7 +38,7 @@ static void print_object_attribute(SaNtfAttributeT *input)
void ntfsv_print_object_attributes(SaNtfAttributeT *objectAttributes,
SaUint16T numAttributes)
{
- int i;
+ SaUint16T i;
(void)TRACE_2("numAttr: %d\n", (int)numAttributes);
for (i = 0; i < numAttributes; i++) {
@@ -319,7 +319,8 @@ static uint32_t decodeNtfValueT(NCS_UBAID *uba, SaNtfValueTypeT attributeType,
static uint32_t decodeSaNtfAttributeChangeT(NCS_UBAID *uba,
SaNtfAttributeChangeT *ntfAttr)
{
- uint8_t *p8, rv;
+ uint8_t *p8;
+ uint32_t rv;
uint8_t local_data[8];
p8 = ncs_dec_flatten_space(uba, local_data, 8);
ntfAttr->attributeId = ncs_decode_16bit(&p8);
@@ -402,7 +403,7 @@ static uint32_t ntfsv_enc_not_header(NCS_UBAID *uba,
{
uint8_t *p8;
uint32_t rv = NCSCC_RC_SUCCESS;
- int i;
+ SaUint16T i;
/* additional text */
p8 = ncs_enc_reserve_space(uba, 10);
@@ -414,7 +415,6 @@ static uint32_t ntfsv_enc_not_header(NCS_UBAID *uba,
ncs_encode_16bit(&p8, param->numAdditionalInfo);
ncs_encode_32bit(&p8, *param->eventType);
ncs_enc_claim_space(uba, 10);
- rv = NCSCC_RC_SUCCESS;
rv = encodeSaNameT(uba, p8, param->notificationObject);
if (rv == 0) {
@@ -448,7 +448,7 @@ static uint32_t ntfsv_enc_not_header(NCS_UBAID *uba,
}
ncs_encode_64bit(&p8, *param->notificationId);
ncs_enc_claim_space(uba, 8);
- TRACE_2("ENC: Not ptr %p: %llu", param->notificationId,
+ TRACE_2("ENC: Not ptr %p: %llu", (void *)param->notificationId,
*param->notificationId);
ncs_encode_n_octets_in_uba(uba, (uint8_t *)param->additionalText,
@@ -504,7 +504,7 @@ uint32_t ntfsv_enc_not_msg(NCS_UBAID *uba, ntfsv_send_not_req_t *param)
ncs_enc_claim_space(uba, 8);
switch (param->notificationType) {
- int i;
+ SaUint16T i;
case SA_NTF_TYPE_ALARM:
TRACE("enc SA_NTF_TYPE_ALARM");
ntfsv_enc_not_header(
@@ -545,7 +545,7 @@ uint32_t ntfsv_enc_not_msg(NCS_UBAID *uba, ntfsv_send_not_req_t *param)
&p8,
param->notification.alarm.thresholdInformation->armTime);
ncs_enc_claim_space(uba, 12);
- TRACE("thresholdInformation->thresholdValueType %hu",
+ TRACE("thresholdInformation->thresholdValueType %u",
param->notification.alarm.thresholdInformation
->thresholdValueType);
rv = encodeSaNtfValueT(
@@ -865,7 +865,7 @@ uint32_t ntfsv_enc_discard_msg(NCS_UBAID *uba, ntfsv_discarded_info_t *param)
{
uint8_t *p8;
uint32_t rv = NCSCC_RC_SUCCESS;
- int i;
+ uint32_t i;
TRACE_ENTER();
osafassert(uba != NULL);
@@ -902,7 +902,7 @@ static uint32_t ntfsv_dec_not_header(NCS_UBAID *uba,
uint32_t rv = NCSCC_RC_SUCCESS;
SaAisErrorT rc;
uint8_t local_data[8];
- int i;
+ SaUint16T i;
/* SaNtfNotificationHeaderT size params */
SaUint16T numCorrelatedNotifications;
SaUint16T lengthAdditionalText;
@@ -984,7 +984,7 @@ uint32_t ntfsv_dec_not_msg(NCS_UBAID *uba, ntfsv_send_not_req_t *param)
ncs_dec_skip_space(uba, 4);
switch (param->notificationType) {
- int i;
+ SaUint16T i;
case SA_NTF_TYPE_ALARM:
TRACE("dec SA_NTF_TYPE_ALARM");
@@ -1243,7 +1243,7 @@ uint32_t ntfsv_dec_discard_msg(NCS_UBAID *uba, ntfsv_discarded_info_t *param)
{
uint8_t *p8;
uint8_t local_data[8];
- int i;
+ uint32_t i;
TRACE_ENTER();
p8 = ncs_dec_flatten_space(uba, local_data, 8);
@@ -1275,7 +1275,7 @@ uint32_t ntfsv_dec_discard_msg(NCS_UBAID *uba, ntfsv_discarded_info_t *param)
uint32_t ntfsv_enc_filter_header(NCS_UBAID *uba,
SaNtfNotificationFilterHeaderT *h)
{
- int i;
+ SaUint16T i;
uint32_t rv;
uint8_t *p8;
@@ -1327,7 +1327,7 @@ static uint32_t ntfsv_enc_filter_msg(NCS_UBAID *uba, ntfsv_filter_ptrs_t *f_rec)
{
uint8_t *p8;
uint32_t rv = NCSCC_RC_SUCCESS;
- int i;
+ SaUint16T i;
TRACE_3("alarm filter p: %p", f_rec->alarm_filter);
if (f_rec->alarm_filter != NULL) {
@@ -1663,7 +1663,7 @@ uint32_t ntfsv_enc_subscribe_msg(NCS_UBAID *uba, ntfsv_subscribe_req_t *param)
uint32_t ntfsv_dec_filter_header(NCS_UBAID *uba,
SaNtfNotificationFilterHeaderT *h)
{
- int i;
+ SaUint16T i;
uint8_t *p8;
uint32_t rv = NCSCC_RC_FAILURE;
uint8_t local_data[8];
@@ -1720,7 +1720,7 @@ error_done:
static uint32_t ntfsv_dec_filter_msg(NCS_UBAID *uba, ntfsv_filter_ptrs_t *f_rec)
{
- int i;
+ SaUint16T i;
uint8_t *p8;
uint32_t rv = NCSCC_RC_OUT_OF_MEM;
uint32_t filter_type;
diff --git a/src/ntf/common/ntfsv_mem.c b/src/ntf/common/ntfsv_mem.c
index 64228dece..b3a195d69 100644
--- a/src/ntf/common/ntfsv_mem.c
+++ b/src/ntf/common/ntfsv_mem.c
@@ -517,13 +517,13 @@ done:
if (rc != SA_AIS_OK) {
ntfsv_free_security_alarm(securityAlarm, false);
}
- return SA_AIS_OK;
+ return rc;
}
void ntfsv_copy_ntf_header(SaNtfNotificationHeaderT *dest,
const SaNtfNotificationHeaderT *src)
{
- int i;
+ SaUint16T i;
TRACE_ENTER();
*(dest->eventType) = *(src->eventType);
@@ -579,7 +579,7 @@ void ntfsv_copy_ntf_header(SaNtfNotificationHeaderT *dest,
void ntfsv_copy_ntf_alarm(SaNtfAlarmNotificationT *dest,
const SaNtfAlarmNotificationT *src)
{
- int i;
+ SaUint16T i;
TRACE_ENTER();
ntfsv_copy_ntf_header(&dest->notificationHeader,
&src->notificationHeader);
@@ -1481,7 +1481,7 @@ ntfsv_copy_ntf_filter_header(SaNtfNotificationFilterHeaderT *pDes,
const SaNtfNotificationFilterHeaderT *pSrc)
{
SaAisErrorT rc = SA_AIS_OK;
- int i;
+ SaUint16T i;
/* Event Types */
pDes->numEventTypes = pSrc->numEventTypes;
for (i = 0; i < pDes->numEventTypes; i++)
@@ -1512,7 +1512,7 @@ ntfsv_copy_ntf_filter_alarm(SaNtfAlarmNotificationFilterT *pDes,
const SaNtfAlarmNotificationFilterT *pSrc)
{
SaAisErrorT rc = SA_AIS_OK;
- int i;
+ SaUint16T i;
pDes->notificationFilterHandle = pSrc->notificationFilterHandle;
if ((rc = ntfsv_copy_ntf_filter_header(
&pDes->notificationFilterHeader,
@@ -1543,7 +1543,7 @@ SaAisErrorT ntfsv_copy_ntf_filter_sec_alarm(
const SaNtfSecurityAlarmNotificationFilterT *pSrc)
{
SaAisErrorT rc = SA_AIS_OK;
- int i;
+ SaUint16T i;
pDes->notificationFilterHandle = pSrc->notificationFilterHandle;
if ((rc = ntfsv_copy_ntf_filter_header(
&pDes->notificationFilterHeader,
@@ -1582,7 +1582,7 @@ ntfsv_copy_ntf_filter_state_ch(SaNtfStateChangeNotificationFilterT *pDes,
const SaNtfStateChangeNotificationFilterT *pSrc)
{
SaAisErrorT rc = SA_AIS_OK;
- int i;
+ SaUint16T i;
pDes->notificationFilterHandle = pSrc->notificationFilterHandle;
if ((rc = ntfsv_copy_ntf_filter_header(
&pDes->notificationFilterHeader,
@@ -1608,7 +1608,7 @@ SaAisErrorT ntfsv_copy_ntf_filter_obj_cr_del(
const SaNtfObjectCreateDeleteNotificationFilterT *pSrc)
{
SaAisErrorT rc = SA_AIS_OK;
- int i;
+ SaUint16T i;
pDes->notificationFilterHandle = pSrc->notificationFilterHandle;
if ((rc = ntfsv_copy_ntf_filter_header(
&pDes->notificationFilterHeader,
diff --git a/src/ntf/ntfd/NtfFilter.cc b/src/ntf/ntfd/NtfFilter.cc
index 30a01523a..3f6e2abd8 100644
--- a/src/ntf/ntfd/NtfFilter.cc
+++ b/src/ntf/ntfd/NtfFilter.cc
@@ -51,7 +51,7 @@ bool NtfFilter::checkEventType(SaNtfNotificationFilterHeaderT *fh,
const SaNtfNotificationHeaderT *h) {
TRACE_8("num EventTypes: %hd", fh->numEventTypes);
if (fh->numEventTypes) {
- for (int i = 0; i < fh->numEventTypes; i++) {
+ for (SaUint16T i = 0; i < fh->numEventTypes; i++) {
if (*h->eventType == fh->eventTypes[i]) {
TRACE_2("EventTypes matches");
return true;
@@ -67,7 +67,7 @@ bool NtfFilter::checkNtfClassId(SaNtfNotificationFilterHeaderT *fh,
const SaNtfNotificationHeaderT *h) {
TRACE_8("numNotificationClassIds: %hd", fh->numNotificationClassIds);
if (fh->numNotificationClassIds) {
- for (int i = 0; i < fh->numNotificationClassIds; i++)
+ for (SaUint16T i = 0; i < fh->numNotificationClassIds; i++)
if (h->notificationClassId->vendorId ==
fh->notificationClassIds[i].vendorId &&
h->notificationClassId->minorId ==
@@ -88,7 +88,7 @@ bool NtfFilter::checkSourceIndicator(SaUint16T numSi,
SaNtfSourceIndicatorT *s) {
TRACE_8("numSi: %hd", numSi);
if (numSi) {
- for (int i = 0; i < numSi; i++) {
+ for (SaUint16T i = 0; i < numSi; i++) {
if (*s == sis[i]) {
TRACE_2("Sourceind matches");
return true;
@@ -235,7 +235,7 @@ NtfAlarmFilter::NtfAlarmFilter(SaNtfAlarmNotificationFilterT *f)
}
NtfAlarmFilter::~NtfAlarmFilter() {
- TRACE_8("destructor p = %p", filter_);
+ TRACE_8("destructor p = %p", (void *)filter_);
ntfsv_filter_alarm_free(filter_, true);
free(filter_);
}
@@ -243,7 +243,7 @@ NtfAlarmFilter::~NtfAlarmFilter() {
bool NtfAlarmFilter::checkTrend(SaNtfAlarmNotificationT *a) {
TRACE_8("num Trends: %hd", filter_->numTrends);
if (filter_->numTrends) {
- for (int i = 0; i < filter_->numTrends; i++) {
+ for (SaUint16T i = 0; i < filter_->numTrends; i++) {
if (*a->trend == filter_->trends[i]) {
TRACE_2("trends matches");
return true;
@@ -258,7 +258,7 @@ bool NtfAlarmFilter::checkTrend(SaNtfAlarmNotificationT *a) {
bool NtfAlarmFilter::checkPerceivedSeverity(SaNtfAlarmNotificationT *a) {
TRACE_8("num Perceivedseverities: %hd", filter_->numPerceivedSeverities);
if (filter_->numPerceivedSeverities) {
- for (int i = 0; i < filter_->numPerceivedSeverities; i++) {
+ for (SaUint16T i = 0; i < filter_->numPerceivedSeverities; i++) {
if (*a->perceivedSeverity == filter_->perceivedSeverities[i]) {
TRACE_2("perceivedseverities matches");
return true;
@@ -273,7 +273,7 @@ bool NtfAlarmFilter::checkPerceivedSeverity(SaNtfAlarmNotificationT *a) {
bool NtfAlarmFilter::checkprobableCause(SaNtfAlarmNotificationT *a) {
TRACE_8("num ProbableCauses: %hd", filter_->numProbableCauses);
if (filter_->numProbableCauses) {
- for (int i = 0; i < filter_->numProbableCauses; i++) {
+ for (SaUint16T i = 0; i < filter_->numProbableCauses; i++) {
if (*a->probableCause == filter_->probableCauses[i]) {
TRACE_2("probableCauses matches");
return true;
@@ -312,7 +312,7 @@ NtfSecurityAlarmFilter::NtfSecurityAlarmFilter(
}
NtfSecurityAlarmFilter::~NtfSecurityAlarmFilter() {
- TRACE_8("destructor p = %p", filter_);
+ TRACE_8("destructor p = %p", (void *)filter_);
ntfsv_filter_sec_alarm_free(filter_, true);
free(filter_);
}
@@ -344,7 +344,7 @@ bool NtfSecurityAlarmFilter::checkProbableCause(
SaNtfSecurityAlarmNotificationT *s) {
TRACE_8("num ProbableCauses: %hd", filter_->numProbableCauses);
if (filter_->numProbableCauses) {
- for (int i = 0; i < filter_->numProbableCauses; i++) {
+ for (SaUint16T i = 0; i < filter_->numProbableCauses; i++) {
if (*s->probableCause == filter_->probableCauses[i]) {
TRACE_2("probableCauses matches");
return true;
@@ -359,7 +359,7 @@ bool NtfSecurityAlarmFilter::checkProbableCause(
bool NtfSecurityAlarmFilter::checkSeverity(SaNtfSecurityAlarmNotificationT *s) {
TRACE_8("severities: %hd", filter_->numSeverities);
if (filter_->numSeverities) {
- for (int i = 0; i < filter_->numSeverities; i++) {
+ for (SaUint16T i = 0; i < filter_->numSeverities; i++) {
if (*s->severity == filter_->severities[i]) {
TRACE_2("Severity matches");
return true;
@@ -375,7 +375,7 @@ bool NtfSecurityAlarmFilter::checkServiceUser(
SaNtfSecurityAlarmNotificationT *s) {
TRACE_8("serverUsers: %hd", filter_->numServiceUsers);
if (filter_->numServiceUsers) {
- for (int i = 0; i < filter_->numServiceUsers; i++) {
+ for (SaUint16T i = 0; i < filter_->numServiceUsers; i++) {
if (cmpSaNtfValueT(s->serviceUser->valueType, &s->serviceUser->value,
filter_->serviceUsers[i].valueType,
&filter_->serviceUsers[i].value)) {
@@ -393,7 +393,7 @@ bool NtfSecurityAlarmFilter::checkServiceProvider(
SaNtfSecurityAlarmNotificationT *s) {
TRACE_8("serverProviders: %hd", filter_->numServiceProviders);
if (filter_->numServiceProviders) {
- for (int i = 0; i < filter_->numServiceProviders; i++) {
+ for (SaUint16T i = 0; i < filter_->numServiceProviders; i++) {
if (cmpSaNtfValueT(s->serviceProvider->valueType,
&s->serviceProvider->value,
filter_->serviceProviders[i].valueType,
@@ -412,7 +412,7 @@ bool NtfSecurityAlarmFilter::checkSecurityAlarmDetector(
SaNtfSecurityAlarmNotificationT *s) {
TRACE_8("serverProviders: %hd", filter_->numSecurityAlarmDetectors);
if (filter_->numSecurityAlarmDetectors) {
- for (int i = 0; i < filter_->numSecurityAlarmDetectors; i++) {
+ for (SaUint16T i = 0; i < filter_->numSecurityAlarmDetectors; i++) {
if (cmpSaNtfValueT(s->securityAlarmDetector->valueType,
&s->securityAlarmDetector->value,
filter_->securityAlarmDetectors[i].valueType,
@@ -434,7 +434,7 @@ NtfObjectCreateDeleteFilter::NtfObjectCreateDeleteFilter(
}
NtfObjectCreateDeleteFilter::~NtfObjectCreateDeleteFilter() {
- TRACE_8("destructor p = %p", filter_);
+ TRACE_8("destructor p = %p", (void *)filter_);
ntfsv_filter_obj_cr_del_free(filter_, true);
free(filter_);
}
@@ -468,7 +468,7 @@ NtfStateChangeFilter::NtfStateChangeFilter(
}
NtfStateChangeFilter::~NtfStateChangeFilter() {
- TRACE_8("destructor p = %p", filter_);
+ TRACE_8("destructor p = %p", (void *)filter_);
ntfsv_filter_state_ch_free(filter_, true);
free(filter_);
}
@@ -497,7 +497,7 @@ bool NtfStateChangeFilter::checkFilter(NtfSmartPtr ¬if) {
}
bool NtfStateChangeFilter::checkStateId(SaUint16T ns, SaNtfStateChangeT *sc) {
- int i, j;
+ SaUint16T i, j;
if (filter_->numStateChanges) {
for (i = 0; i < filter_->numStateChanges; i++) {
for (j = 0; j < ns; j++) {
@@ -539,7 +539,7 @@ bool NtfAttributeChangeFilter::checkFilter(NtfSmartPtr ¬if) {
}
NtfAttributeChangeFilter::~NtfAttributeChangeFilter() {
- TRACE_8("destructor p = %p", filter_);
+ TRACE_8("destructor p = %p", (void *)filter_);
ntfsv_filter_attr_ch_free(filter_, true);
free(filter_);
}
diff --git a/src/ntf/ntfd/NtfNotification.cc b/src/ntf/ntfd/NtfNotification.cc
index 213ad1b97..fb9edc019 100644
--- a/src/ntf/ntfd/NtfNotification.cc
+++ b/src/ntf/ntfd/NtfNotification.cc
@@ -43,7 +43,7 @@ NtfNotification::NtfNotification(SaNtfIdentifierT notificationId,
logged = false;
loggFromCallback_ = false;
waitAck_ = false;
- TRACE_3("constructor %p, notId: %llu", this, notificationId);
+ TRACE_3("constructor %p, notId: %llu", (void *)this, notificationId);
sendNotInfo_ = sendNotInfo;
SaNtfNotificationHeaderT* header;
ntfsv_get_ntf_header(sendNotInfo_, &header);
@@ -217,7 +217,7 @@ void NtfNotification::removeSubscription(unsigned int clientId) {
while (pos != subscriptionList.end()) {
TRACE_1("Searching for subscription for client %u in notification %llu",
clientId, notificationId_);
- if ((pos->clientId == clientId)) {
+ if (pos->clientId == clientId) {
TRACE_1("Removing subscription %u for client %u in notification %llu",
pos->subscriptionId, clientId, notificationId_);
pos = subscriptionList.erase(pos);
diff --git a/src/ntf/ntfd/ntfs_mbcsv.c b/src/ntf/ntfd/ntfs_mbcsv.c
index 28bb97e88..cdb08cb78 100644
--- a/src/ntf/ntfd/ntfs_mbcsv.c
+++ b/src/ntf/ntfd/ntfs_mbcsv.c
@@ -1107,7 +1107,7 @@ static uint32_t ckpt_decode_cold_sync(ntfs_cb_t *cb, NCS_MBCSV_CB_ARG *cbk_arg)
uint8_t *ptr;
uint8_t data_cnt[16];
struct NtfGlobals ntfGlobals;
- SaNtfNotificationHeaderT *header;
+ SaNtfNotificationHeaderT *header = NULL;
memset(&ntfGlobals, 0, sizeof(struct NtfGlobals));
TRACE_ENTER2("COLD SYNC DECODE START........");
@@ -1321,7 +1321,7 @@ static uint32_t ckpt_decode_cold_sync(ntfs_cb_t *cb, NCS_MBCSV_CB_ARG *cbk_arg)
noOfSubscriptions--;
}
ntfsv_dec_32bit_msg(&cbk_arg->info.decode.i_uba, &logged);
- if (logged) {
+ if (logged && header) {
notificationLoggedConfirmed(*header->notificationId);
}
num_rec--;
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-08-25 09:14:28
|
Summary: imm: log missing attribute when it does not exist [#3379] Review request for Ticket(s): 3379 Peer Reviewer(s): Thang, Tai, Dat Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3379 Base revision: be06c19d6b4dd4b6646f5801d9311d906db021f9 Personal repository: git://git.code.sf.net/u/thienhuynh/review -------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 21578b9792dbb994ea9d7866ba108e82e9fd26fc Author: thien.m.huynh <thi...@en...> Date: Mon, 25 Aug 2025 14:27:57 +0700 imm: log missing attribute when it does not exist [#3379] Previously, only sought and matched attributes were logged, which was insufficient for debugging. It was unclear which attributes were missing in the cluster. This commit adds logging to explicitly show missing attributes, making debugging more straightforward. Complete diffstat: ------------------ src/imm/immnd/ImmModel.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) Testing Commands: ----------------- immlist -a testmissingattr smfConfig=1,safApp=safSmfService Testing, Expected Results: -------------------------- NO ERR_NOT_EXIST: Some attributeNames 'testmissingattr' did not exist in Object 'smfConfig=1,safApp=safSmfService' (nrof names:1 matched:0) Conditions of Submission: ------------------------- ACK from reviewers Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y 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 ~/.gitconfig file (i.e. user.name, user.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. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-08-25 08:16:09
|
Previously, only sought and matched attributes were logged, which was
insufficient for debugging. It was unclear which attributes were missing
in the cluster.
This commit adds logging to explicitly show missing attributes, making
debugging more straightforward.
---
src/imm/immnd/ImmModel.cc | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index d0add57d8..38e2577de 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -12117,6 +12117,7 @@ SaAisErrorT ImmModel::accessorGet(const ImmsvOmSearchInit* req,
ImplementerEvtMap::iterator iem;
int matchedAttributes = 0;
int soughtAttributes = 0;
+ std::set<std::string> missingAttrs = {};
SaImmSearchOptionsT notAllowedOptions = 0LL;
bool nonExtendedNameCheck =
req->searchParam.present > ImmOmSearchParameter_PR_oneAttrParam;
@@ -12309,6 +12310,9 @@ SaAisErrorT ImmModel::accessorGet(const ImmsvOmSearchInit* req,
if (!soughtAttributes) {
while (list) {
++soughtAttributes;
+ size_t sz = strnlen((char*)list->name.buf, (size_t)list->name.size);
+ std::string attName((const char*)list->name.buf, sz);
+ missingAttrs.insert(attName);
list = list->next;
}
}
@@ -12319,6 +12323,7 @@ SaAisErrorT ImmModel::accessorGet(const ImmsvOmSearchInit* req,
std::string attName((const char*)list->name.buf, sz);
if (j->first == attName) {
notFound = false;
+ missingAttrs.erase(attName);
++matchedAttributes;
break;
}
@@ -12439,10 +12444,16 @@ SaAisErrorT ImmModel::accessorGet(const ImmsvOmSearchInit* req,
if ((searchOptions & SA_IMM_SEARCH_GET_SOME_ATTR) &&
(matchedAttributes != soughtAttributes)) {
+ std::string attributeNames = {};
+ for (auto it = missingAttrs.begin(); it != missingAttrs.end(); ++it) {
+ if (it != missingAttrs.begin()) attributeNames += ", ";
+ attributeNames += *it;
+ }
LOG_NO(
- "ERR_NOT_EXIST: Some attributeNames did not exist in Object '%s' "
- "(nrof names:%u matched:%u)",
- objectName.c_str(), soughtAttributes, matchedAttributes);
+ "ERR_NOT_EXIST: Some attributeNames '%s' did not exist in Object '%s' "
+ "(nrof names:%d matched:%d)",
+ attributeNames.c_str(), objectName.c_str(), soughtAttributes,
+ matchedAttributes);
err = SA_AIS_ERR_NOT_EXIST;
}
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-08-21 02:29:30
|
Hi Tai,
ACK from me.
Best Regards,
Thien
________________________________
From: Tai Nguyen <tai...@en...>
Sent: Monday, August 18, 2025 10:00 AM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Thang Nguyen <tha...@en...>
Cc: ope...@li... <ope...@li...>; Tai Nguyen <tai...@en...>
Subject: [PATCH 1/1] amf: Fix coding issue identified by codechecker [#3374]
---
src/amf/amfd/comp.cc | 1 +
src/amf/amfd/csiattr.cc | 1 -
src/amf/amfd/sg_npm_fsm.cc | 7 +++++--
src/amf/amfnd/clc.cc | 1 +
src/amf/amfnd/comp.cc | 2 +-
5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/amf/amfd/comp.cc b/src/amf/amfd/comp.cc
index d5cdb9388..601eb1730 100644
--- a/src/amf/amfd/comp.cc
+++ b/src/amf/amfd/comp.cc
@@ -1717,6 +1717,7 @@ static SaAisErrorT ccb_completed_modify_hdlr(CcbUtilOperationData_t *opdata) {
LOG_WA("Comp modify completed (STDBY): comp does not exist");
return SA_AIS_OK;
}
+ osafassert(comp);
while ((attr_mod = opdata->param.modify.attrMods[i++]) != nullptr) {
const SaImmAttrValuesT_2 *attribute = &attr_mod->modAttr;
diff --git a/src/amf/amfd/csiattr.cc b/src/amf/amfd/csiattr.cc
index f52722b39..91a8530c5 100644
--- a/src/amf/amfd/csiattr.cc
+++ b/src/amf/amfd/csiattr.cc
@@ -591,7 +591,6 @@ static void csiattr_modify_apply(CcbUtilOperationData_t *opdata) {
memcpy(tmp_csi_attr->name_value.string_ptr, value, strlen(value) + 1);
osaf_extended_name_alloc(tmp_csi_attr->name_value.string_ptr,
&tmp_csi_attr->name_value.value);
- i = 1;
} else {
for (i = 0; i < attribute->attrValuesNumber; i++) {
char *value = *(char **)attribute->attrValues[i++];
diff --git a/src/amf/amfd/sg_npm_fsm.cc b/src/amf/amfd/sg_npm_fsm.cc
index fad0a4369..c190d920c 100644
--- a/src/amf/amfd/sg_npm_fsm.cc
+++ b/src/amf/amfd/sg_npm_fsm.cc
@@ -3802,13 +3802,16 @@ void SG_NPM::node_fail_su_oper(AVD_CL_CB *cb, AVD_SU *su) {
if (su == su->sg_of_su->max_assigned_su) {
/* Max_assigned_su is assigned quiesced state as part of SI transfer
and the node went down */
+ TRACE("SI transfer failed %s, max_assigned_su '%s'"
+ "min_assigned_su '%s'",
+ su->sg_of_su->si_tobe_redistributed->name.c_str(),
+ su->sg_of_su->max_assigned_su->name.c_str(),
+ su->sg_of_su->min_assigned_su->name.c_str());
su->sg_of_su->max_assigned_su = nullptr;
su->sg_of_su->min_assigned_su = nullptr;
su->sg_of_su->si_tobe_redistributed = nullptr;
m_AVSV_SEND_CKPT_UPDT_ASYNC_RMV(cb, su->sg_of_su,
AVSV_CKPT_AVD_SI_TRANS);
- TRACE("SI transfer failed for SI '%s' as max_assigned_su went down",
- su->sg_of_su->si_tobe_redistributed->name.c_str());
}
}
diff --git a/src/amf/amfnd/clc.cc b/src/amf/amfnd/clc.cc
index 3a196211a..d17ca0ec0 100644
--- a/src/amf/amfnd/clc.cc
+++ b/src/amf/amfnd/clc.cc
@@ -3112,6 +3112,7 @@ uint32_t avnd_comp_clc_cmd_execute(AVND_CB *cb, AVND_COMP *comp,
uint32_t argc = 0, rc = NCSCC_RC_SUCCESS, count = 0;
m_AVND_COMP_CLC_COUNT_AGRC(scr, comp->clc_info.cmds[cmd_type - 1].len, argc);
char *argv[argc + 2];
+ memset(argv, 0, sizeof(argv));
unsigned int env_counter;
unsigned int i;
SaStringT env;
diff --git a/src/amf/amfnd/comp.cc b/src/amf/amfnd/comp.cc
index 8c0bf35ff..ad729eb67 100644
--- a/src/amf/amfnd/comp.cc
+++ b/src/amf/amfnd/comp.cc
@@ -2151,7 +2151,7 @@ uint32_t avnd_comp_cbk_send(AVND_CB *cb, AVND_COMP *comp,
/* determine csi name */
if (SA_AMF_CSI_TARGET_ALL != csi_flag)
- csi_name = csi_rec->name.c_str();
+ csi_name = csi_rec->name;
else
csi_name = "";
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-08-11 06:24:45
|
Hi Tai,
ACK without comment.
Best Regards,
Thien
________________________________
From: Tai Nguyen <tai...@en...>
Sent: Monday, August 11, 2025 1:11 PM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Thang Nguyen <tha...@en...>
Cc: ope...@li... <ope...@li...>; Tai Nguyen <tai...@en...>
Subject: [PATCH 1/1] smf: fix coding issues identified by codechecker [#3369]
---
src/smf/smfd/SmfUpgradeProcedure.cc | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/smf/smfd/SmfUpgradeProcedure.cc b/src/smf/smfd/SmfUpgradeProcedure.cc
index 0787e928a..cd3f8acd6 100644
--- a/src/smf/smfd/SmfUpgradeProcedure.cc
+++ b/src/smf/smfd/SmfUpgradeProcedure.cc
@@ -1249,7 +1249,9 @@ bool SmfUpgradeProcedure::mergeStepIntoSingleStep(SmfUpgradeProcedure *i_proc,
} else {
LOG_NO(
"SmfUpgradeProcedure::mergeStepIntoSingleStep: Procedure scope not found (forAddRemove/forModify)");
- delete newStep;
+ if (i_newStep == nullptr){
+ delete newStep;
+ }
TRACE_LEAVE();
return false;
}
@@ -3414,9 +3416,13 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
newStep->setProcedure(this);
if (newStep->getState() == SA_SMF_STEP_INITIAL) {
- mergeStepIntoSingleStep(this,
- newStep); // Just merge again, as before si-swap
- if (newStep) addProcStep(newStep);
+ if(!mergeStepIntoSingleStep(this,
+ newStep)) { // Just merge again, as before si-swap
+ delete newStep;
+ TRACE_LEAVE();
+ return SA_AIS_ERR_INIT;
+ }
+ addProcStep(newStep);
} else if (newStep->getState() == SA_SMF_STEP_EXECUTING) {
// Fetch AU/DU and step swNode from IMM steps
SaAisErrorT rc = readCampaignImmModel(newStep);
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-08-11 04:56:18
|
Summary: imm: Fix coding issues identified by Codechecker [#3376] Review request for Ticket(s): 3376 Peer Reviewer(s): Thang, Dat, Tai Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3376 Base revision: e831af5e523e6a961c2995dccb669ac51148bb52 Personal repository: git://git.code.sf.net/u/thienhuynh/review -------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision 0273f34a40fd53b3c29672923534d827ef7b7a04 Author: thien.m.huynh <thi...@en...> Date: Tue, 29 Jul 2025 14:40:32 +0700 imm: Fix coding issues identified by Codechecker [#3376] Complete diffstat: ------------------ src/imm/agent/imma_oi_api.cc | 2 +- src/imm/agent/imma_om_api.cc | 2 +- src/imm/apitest/implementer/applier.c | 2 +- src/imm/apitest/management/populate.c | 2 +- .../management/test_saImmConfigSyncrTimeoutImma.c | 8 +-- src/imm/immloadd/imm_pbe_load.cc | 2 +- src/imm/immnd/ImmModel.cc | 5 +- src/imm/immnd/immnd_evt.c | 38 ++++++------ src/imm/immnd/immnd_main.c | 23 +++++-- src/imm/immnd/immnd_proc.c | 11 ++-- src/imm/tools/imm_admin.c | 18 ++++-- src/imm/tools/imm_cfg.c | 72 +++++++++++++++++----- src/imm/tools/imm_list.c | 24 ++++++-- 13 files changed, 142 insertions(+), 67 deletions(-) Testing Commands: ----------------- N/A Testing, Expected Results: -------------------------- N/A Conditions of Submission: ------------------------- ACK from reviewers Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y 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 ~/.gitconfig file (i.e. user.name, user.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. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-08-11 04:37:36
|
---
src/imm/agent/imma_oi_api.cc | 2 +-
src/imm/agent/imma_om_api.cc | 2 +-
src/imm/apitest/implementer/applier.c | 2 +-
src/imm/apitest/management/populate.c | 2 +-
.../test_saImmConfigSyncrTimeoutImma.c | 8 +--
src/imm/immloadd/imm_pbe_load.cc | 2 +-
src/imm/immnd/ImmModel.cc | 5 +-
src/imm/immnd/immnd_evt.c | 38 +++++-----
src/imm/immnd/immnd_main.c | 23 ++++--
src/imm/immnd/immnd_proc.c | 11 +--
src/imm/tools/imm_admin.c | 18 +++--
src/imm/tools/imm_cfg.c | 72 +++++++++++++++----
src/imm/tools/imm_list.c | 24 +++++--
13 files changed, 142 insertions(+), 67 deletions(-)
diff --git a/src/imm/agent/imma_oi_api.cc b/src/imm/agent/imma_oi_api.cc
index a503e61a5..09b752066 100644
--- a/src/imm/agent/imma_oi_api.cc
+++ b/src/imm/agent/imma_oi_api.cc
@@ -2806,7 +2806,6 @@ mds_send_fail:
}
}
-clm_left:
skip_over_send:
bad_sync:
bad_handle1:
@@ -2839,6 +2838,7 @@ free_obj:
free(p); /*free-2 */
}
+clm_left:
bad_handle:
if (locked) {
m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc
index 30d562b2e..4013bf003 100644
--- a/src/imm/agent/imma_om_api.cc
+++ b/src/imm/agent/imma_om_api.cc
@@ -7732,7 +7732,7 @@ mds_send_fail:
free(req->searchParam.choice.oneAttrParam.attrName.buf); /*free-2 */
req->searchParam.choice.oneAttrParam.attrName.buf = NULL;
req->searchParam.choice.oneAttrParam.attrName.size = 0;
- if (searchParam->searchOneAttr.attrValue) { /*free-3 */
+ if (searchParam && searchParam->searchOneAttr.attrValue) { /*free-3 */
immsv_evt_free_att_val(&(req->searchParam.choice.oneAttrParam.attrValue),
searchParam->searchOneAttr.attrValueType);
}
diff --git a/src/imm/apitest/implementer/applier.c b/src/imm/apitest/implementer/applier.c
index 12cc755d6..566532b3c 100644
--- a/src/imm/apitest/implementer/applier.c
+++ b/src/imm/apitest/implementer/applier.c
@@ -213,7 +213,7 @@ static void saImmOiAdminOperationCallback(
SaAisErrorT err =
immutil_saImmOiAdminOperationResult(immOiHandle, invocation, SA_AIS_OK);
if (err != SA_AIS_OK) {
- fprintf(stderr, "Reply on admin operation failed, err:%u\n",
+ fprintf(stderr, "Reply on admin operation failed, err:%d\n",
err);
}
}
diff --git a/src/imm/apitest/management/populate.c b/src/imm/apitest/management/populate.c
index 28fea28bf..c634a482c 100644
--- a/src/imm/apitest/management/populate.c
+++ b/src/imm/apitest/management/populate.c
@@ -172,7 +172,7 @@ static range_obj_t *gen_pop_tree(unsigned int level, range_obj_t *rootObj,
if (reminder) {
fprintf(stderr,
- "error - Returning with nonzero reminder r:%u ix:%u\n",
+ "error - Returning with nonzero reminder r:%u ix:%d\n",
reminder, ix);
abort();
}
diff --git a/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c b/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c
index 039b7e279..eab474e30 100644
--- a/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c
+++ b/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c
@@ -27,22 +27,22 @@
static int get_pid_immnd()
{
FILE *f;
- int pid;
+ int pid = -1;
const char *osafimmnd_pid_file = PKGPIDDIR "/osafimmnd.pid";
if ((f = fopen(osafimmnd_pid_file, "r")) == NULL) {
fprintf(stderr, "Failed to open %s\n", osafimmnd_pid_file);
return -1;
}
- if (fscanf(f, "%d", &pid) == 0) {
+ if (fscanf(f, "%d", &pid) != 1) {
fprintf(stderr, "Could not read PID from file %s\n",
osafimmnd_pid_file);
- return -1;
+ pid = -1;
}
if (fclose(f) != 0) {
fprintf(stderr, "Could not close file\n");
- return -1;
+ pid = -1;
}
return pid;
}
diff --git a/src/imm/immloadd/imm_pbe_load.cc b/src/imm/immloadd/imm_pbe_load.cc
index 3fd9fde5c..a5b0e6e73 100644
--- a/src/imm/immloadd/imm_pbe_load.cc
+++ b/src/imm/immloadd/imm_pbe_load.cc
@@ -254,7 +254,7 @@ bool loadClassFromPbe(void *pbeHandle, SaImmHandleT immHandle,
SaImmAttrFlagsT attrFlags = 0LL;
SaImmAttrValueT attDflt = NULL;
char buf[32];
- snprintf(buf, 32, "Row(%u): <", ++r);
+ snprintf(buf, 32, "Row(%d): <", ++r);
std::string rowStr(buf);
AttrInfo *attr_info = NULL;
char *val;
diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index 0caf5f11e..d0add57d8 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -5402,7 +5402,7 @@ SaAisErrorT ImmModel::adminOwnerChange(const struct immsv_a2nd_admown_set* req,
if (i2 != sCcbVector.end() && (*i2)->isActive()) {
std::string oldOwner;
objectInfo->getAdminOwnerName(&oldOwner);
- if (!release && (adm->mAdminOwnerName == oldOwner)) {
+ if (!release && adm && adm->mAdminOwnerName == oldOwner) {
TRACE("Idempotent adminOwner set for %s on %s",
oldOwner.c_str(), objectName.c_str());
} else if (!release && oldOwner.empty()
@@ -5447,7 +5447,8 @@ SaAisErrorT ImmModel::adminOwnerChange(const struct immsv_a2nd_admown_set* req,
if (i2 != sCcbVector.end() && (*i2)->isActive()) {
std::string oldOwner;
subObj->getAdminOwnerName(&oldOwner);
- if (!release && adm->mAdminOwnerName == oldOwner) {
+ if (!release && adm &&
+ adm->mAdminOwnerName == oldOwner) {
TRACE("Idempotent adminOwner set for %s on %s",
oldOwner.c_str(), subObjName.c_str());
} else {
diff --git a/src/imm/immnd/immnd_evt.c b/src/imm/immnd/immnd_evt.c
index 99e9452ef..46cb85b31 100644
--- a/src/imm/immnd/immnd_evt.c
+++ b/src/imm/immnd/immnd_evt.c
@@ -4718,7 +4718,7 @@ static void immnd_evt_proc_ccb_compl_rsp(IMMND_CB *cb, IMMND_EVT *evt,
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation =
applCtn;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
SaImmOiHandleT implHandle =
@@ -4806,7 +4806,7 @@ static void immnd_evt_proc_ccb_compl_rsp(IMMND_CB *cb, IMMND_EVT *evt,
}
if (arrSize) {
- int ix;
+ unsigned int ix;
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type =
@@ -4873,7 +4873,7 @@ static void immnd_evt_proc_ccb_compl_rsp(IMMND_CB *cb, IMMND_EVT *evt,
evt->info.ccbUpcallRsp.ccbId;
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation = 0;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
SaImmOiHandleT implHandle =
@@ -5490,7 +5490,7 @@ static void immnd_evt_pbe_rt_obj_deletes_rsp(IMMND_CB *cb, IMMND_EVT *evt,
noreply:
if (spApplConn && (evt->info.ccbUpcallRsp.result == SA_AIS_OK)) {
- int ix = 0;
+ unsigned int ix = 0;
SaImmHandleT tmp_hdl =
m_IMMSV_PACK_HANDLE(spApplConn, cb->node_id);
/*Fetch client node for Special applier OI */
@@ -5531,7 +5531,7 @@ noreply:
done:
if (arrSize) {
- int ix;
+ unsigned int ix;
for (ix = 0; ix < arrSize; ++ix) {
free(objNameArr[ix]);
}
@@ -7307,7 +7307,7 @@ static void immnd_evt_proc_object_create(IMMND_CB *cb, IMMND_EVT *evt,
/* Re-use the adminOwner member of the ccbCreate message
to hold the invocation id. In this case, 0 => no reply
is expected. */
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
implHandle = m_IMMSV_PACK_HANDLE(
applConnArr[ix], cb->node_id);
@@ -7615,7 +7615,7 @@ static void immnd_evt_proc_object_modify(IMMND_CB *cb, IMMND_EVT *evt,
/* Re-use the adminOwner member of the ccbModify message
to hold the invocation id. In this case, 0 => no reply
is expected. */
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
bool isSpecialApplier = false;
send_evt.info.imma.info.objModify.attrMods =
@@ -8168,7 +8168,7 @@ static void immnd_evt_ccb_abort(IMMND_CB *cb, SaUint32T ccbId,
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type = IMMA_EVT_ND2A_OI_CCB_ABORT_UC;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize; ++ix) {
/*Look up the client node for the implementer, using
* implConn */
@@ -8215,7 +8215,7 @@ static void immnd_evt_ccb_abort(IMMND_CB *cb, SaUint32T ccbId,
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type = IMMA_EVT_ND2A_OI_CCB_ABORT_UC;
send_evt.info.imma.info.ccbCompl.ccbId = ccbId;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize; ++ix) {
SaImmOiHandleT implHandle =
m_IMMSV_PACK_HANDLE(applConnArr[ix], cb->node_id);
@@ -8427,7 +8427,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
: IMMA_EVT_ND2A_OI_OBJ_DELETE_UC;
send_evt.info.imma.info.objDelete.ccbId =
evt->info.objDelete.ccbId;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
if (implConnArr[ix] == 0) {
/* implConn zero => ony for PBE or
@@ -8528,7 +8528,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
/* Re-use the adminOwner member of the ccbDelete message to hold
the invocation id. In this case, 0 => no reply is expected.
*/
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK;
++ix) { /* Iterate over deleted objects */
SaUint32T *applConnArr = NULL;
@@ -8543,7 +8543,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
cb, &objName, evt->info.objDelete.ccbId,
&applConnArr, true);
- int ix2 = 0;
+ unsigned int ix2 = 0;
for (; ix2 < arrSize2 && err == SA_AIS_OK;
++ix2) { /* Iterate over applier connections for
object */
@@ -8661,7 +8661,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
}
if (arrSize) {
- int ix;
+ unsigned int ix;
free(implConnArr);
implConnArr = NULL;
free(invocArr);
@@ -8921,7 +8921,7 @@ static void immnd_evt_proc_rt_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
}
if (spApplConn && (err == SA_AIS_OK) && !delayedReply) {
- int ix = 0;
+ unsigned int ix = 0;
/* Indicates object is marked with SA_IMM_ATTR_NOTIFY and
special applier is present at this node and we dont need to
wait for ack from PBE (non persistent RTO or PBE not
@@ -8963,7 +8963,7 @@ static void immnd_evt_proc_rt_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
done:
if (arrSize) {
- int ix;
+ unsigned int ix;
for (ix = 0; ix < arrSize; ++ix) {
free(objNameArr[ix]);
}
@@ -9201,7 +9201,7 @@ static void immnd_evt_proc_ccb_apply(IMMND_CB *cb, IMMND_EVT *evt,
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type =
IMMA_EVT_ND2A_OI_CCB_COMPLETED_UC;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
/*Look up the client node for the implementer,
@@ -9431,7 +9431,7 @@ skip_send:
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation =
applCtn;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
implHandle = m_IMMSV_PACK_HANDLE(
@@ -9514,7 +9514,7 @@ skip_send:
evt->info.ccbId;
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation = 0;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
implHandle = m_IMMSV_PACK_HANDLE(
@@ -10214,7 +10214,7 @@ uint32_t immnd_evt_proc_pbe_prto_purge_mutations(IMMND_CB *cb, IMMND_EVT *evt,
uint32_t rc = NCSCC_RC_SUCCESS;
IMMSV_EVT send_evt;
IMMND_IMM_CLIENT_NODE *cl_node = NULL;
- int ix = 0;
+ unsigned int ix = 0;
osafassert(reqConnArr);
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMA;
diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c
index 50bbb57ec..30d504b56 100644
--- a/src/imm/immnd/immnd_main.c
+++ b/src/imm/immnd/immnd_main.c
@@ -148,23 +148,36 @@ static char** parse_reserved_class_names(const char* input)
LOG_ER("The reserved name `%s` is invalid!", token);
goto freedata;
}
- result = (char**)realloc(result, sizeof(char*) * ++n_elements);
+ char **temp =
+ (char **)realloc(result, sizeof(char *) * ++n_elements);
+ if (temp == NULL) {
+ LOG_ER("Memory allocation failed during realloc!");
+ goto freedata;
+ }
+ result = temp;
result[n_elements - 1] = strdup(token);
token = strsep(&dup, ",");
}
- result = (char**)realloc(result, sizeof(char*) * (n_elements + 1));
+ char **temp = (char**)realloc(result, sizeof(char*) * (n_elements + 1));
+ if (temp == NULL) {
+ LOG_ER("Final realloc failed!");
+ goto freedata;
+ }
+ result = temp;
result[n_elements] = 0;
free(tofree);
return result;
freedata:
- for (i = 0; i < n_elements; i++) {
- if (result[i]) free(result[i]);
+ if (result != NULL) {
+ for (i = 0; i < n_elements; i++) {
+ if (result[i]) free(result[i]);
+ }
+ free(result);
}
free(tofree);
- free(result);
return NULL;
}
diff --git a/src/imm/immnd/immnd_proc.c b/src/imm/immnd/immnd_proc.c
index 5df703799..3fa856d98 100644
--- a/src/imm/immnd/immnd_proc.c
+++ b/src/imm/immnd/immnd_proc.c
@@ -893,8 +893,9 @@ void immnd_adjustEpoch(IMMND_CB *cb, bool increment)
*/
}
- int newEpoch = immModel_adjustEpoch(cb, cb->mMyEpoch, &continuationId,
- &pbeConn, pbeNodeIdPtr, increment);
+ SaUint32T newEpoch =
+ immModel_adjustEpoch(cb, cb->mMyEpoch, &continuationId, &pbeConn,
+ pbeNodeIdPtr, increment);
if (newEpoch != cb->mMyEpoch) {
/*This case only relevant when persistent epoch overrides
last epoch, i.e. after reload at cluster start. */
@@ -1424,8 +1425,8 @@ static void immnd_cleanTheHouse(IMMND_CB *cb, bool iAmCoordNow)
&oi_cl_node);
osafassert(oi_cl_node);
osafassert(!(oi_cl_node->mIsStale));
- for (int ix = 0; ix < ccbIdArrSize;
- ++ix) {
+ for (unsigned int ix = 0;
+ ix < ccbIdArrSize; ++ix) {
TRACE_2(
"Fetch ccb outcome for ccb%u, nodeId:%u, conn:%u implId:%u",
ccbIdArr[ix], pbeNodeId,
@@ -1723,7 +1724,7 @@ static bool immnd_ccbsTerminated(IMMND_CB *cb, SaUint32T duration,
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMD;
send_evt.info.immd.type = IMMD_EVT_ND2D_ABORT_CCB;
- int ix;
+ unsigned int ix;
immModel_getNonCriticalCcbs(cb, &ccbIdArr, &ccbIdArrSize);
for (ix = 0; ix < ccbIdArrSize; ++ix) {
diff --git a/src/imm/tools/imm_admin.c b/src/imm/tools/imm_admin.c
index 1d908f53e..8e5c5d793 100644
--- a/src/imm/tools/imm_admin.c
+++ b/src/imm/tools/imm_admin.c
@@ -211,7 +211,7 @@ void print_param(SaImmAdminOperationParamsT_2 *param)
ctime_r(&time, buf);
buf[strlen(buf) - 1] = '\0'; /* Remove new line */
- printf("%-50s %-12s %llu (0x%llx, %s)\n", param->paramName,
+ printf("%-50s %-12s %lld (0x%llx, %s)\n", param->paramName,
"SA_TIME_T", (*((SaTimeT *)param->paramBuffer)),
(*((SaTimeT *)param->paramBuffer)), buf);
} break;
@@ -328,7 +328,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
break;
- case 'O':
+ case 'O': {
if (operationId != -1) {
fprintf(
stderr,
@@ -337,9 +337,15 @@ int main(int argc, char *argv[])
}
operationId = SA_IMM_PARAM_ADMOP_ID_ESC;
params_len++;
- params = realloc(
+ const SaImmAdminOperationParamsT_2 **tmp = realloc(
params, (params_len + 1) *
sizeof(SaImmAdminOperationParamsT_2 *));
+ if (tmp == NULL){
+ fprintf(stderr, "realloc() error");
+ if (params) free(params);
+ exit(EXIT_FAILURE);
+ }
+ params = tmp;
param = malloc(sizeof(SaImmAdminOperationParamsT_2));
params[params_len - 1] = param;
params[params_len] = NULL;
@@ -348,8 +354,8 @@ int main(int argc, char *argv[])
param->paramBuffer = malloc(sizeof(SaStringT));
*((SaStringT *)(param->paramBuffer)) = strdup(optarg);
opName = strdup(optarg);
- break;
- case 'p':
+ } break;
+ case 'p': {
params_len++;
const SaImmAdminOperationParamsT_2 **tmp = realloc(
params, (params_len + 1) *
@@ -368,7 +374,7 @@ int main(int argc, char *argv[])
optarg);
exit(EXIT_FAILURE);
}
- break;
+ } break;
case 't':
timeoutVal = strtoll(optarg, (char **)NULL, 10);
diff --git a/src/imm/tools/imm_cfg.c b/src/imm/tools/imm_cfg.c
index 24648e692..b4972c874 100644
--- a/src/imm/tools/imm_cfg.c
+++ b/src/imm/tools/imm_cfg.c
@@ -241,7 +241,7 @@ static void free_attr_value(SaImmValueTypeT attrValueType,
static void free_attr_values(SaImmAttrValuesT_2 *attrValues)
{
- int i;
+ SaUint32T i;
if (attrValues) {
free(attrValues->attrName);
@@ -257,7 +257,7 @@ static void free_attr_values(SaImmAttrValuesT_2 *attrValues)
static void free_attr_mod(SaImmAttrModificationT_2 *attrMod)
{
- int i;
+ SaUint32T i;
if (attrMod) {
if (attrMod->modAttr.attrName)
free(attrMod->modAttr.attrName);
@@ -594,10 +594,18 @@ int object_create(const SaNameT **objectNames, const SaImmClassNameT className,
}
}
if (!attrAdded) {
-
- attrValues = realloc(attrValues,
- (attr_len + 1) *
- sizeof(SaImmAttrValuesT_2 *));
+ SaImmAttrValuesT_2 **temp = NULL;
+ temp = realloc(attrValues,
+ (attr_len + 1) *
+ sizeof(SaImmAttrValuesT_2 *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ free(attrValue->attrName);
+ free(attrValue->attrValues);
+ free(attrValue);
+ goto done;
+ }
+ attrValues = temp;
attrValues[attr_len - 1] = attrValue;
attrValues[attr_len] = NULL;
attr_len++;
@@ -845,9 +853,15 @@ int object_modify(const SaNameT **objectNames, char **optargs, int optargs_len)
}
if (!attrAdded) {
- attrMods = realloc(
- attrMods, (attr_len + 1) *
- sizeof(SaImmAttrModificationT_2 *));
+ SaImmAttrModificationT_2 **temp = NULL;
+ temp = realloc(attrMods,
+ (attr_len + 1) *
+ sizeof(SaImmAttrModificationT_2 *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ goto done;
+ }
+ attrMods = temp;
attrMods[attr_len - 1] = attrMod;
attrMods[attr_len] = NULL;
attr_len++;
@@ -1766,11 +1780,17 @@ static int imm_operation(int argc, char *argv[])
strictParse = 1;
}
break;
- case 'a':
- optargs =
+ case 'a': {
+ char **temp = NULL;
+ temp =
realloc(optargs, ++optargs_len * sizeof(char *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ exit(EXIT_FAILURE);
+ }
+ optargs = temp;
optargs[optargs_len - 1] = strdup(optarg);
- break;
+ } break;
case 'c':
className = optarg;
op = verify_setoption(op, CREATE_OBJECT);
@@ -1933,10 +1953,23 @@ static int imm_operation(int argc, char *argv[])
}
if (op == DELETE_CLASS) {
+ SaImmClassNameT *temp = NULL;
while (optind < argc) {
- classNames =
+ temp =
realloc(classNames, (classNames_len + 1) *
sizeof(SaImmClassNameT *));
+ if (temp == NULL) {
+ fprintf(stderr, "operation DELETE_CLASS - "
+ "realloc failed\n");
+ if (classNames)
+ free(classNames);
+ rc = EXIT_FAILURE;
+ if (!transaction_mode) {
+ goto done_om_finalize;
+ }
+ exit(rc);
+ }
+ classNames = temp;
classNames[classNames_len - 1] =
((SaImmClassNameT)argv[optind++]);
classNames[classNames_len++] = NULL;
@@ -1979,10 +2012,19 @@ static int imm_operation(int argc, char *argv[])
goto done_om_finalize;
}
} else {
+ SaNameT **temp = NULL;
while (optind < argc) {
- objectNames =
- realloc(objectNames,
+ temp = realloc(objectNames,
(objectNames_len + 1) * sizeof(SaNameT *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc failed\n");
+ rc = EXIT_FAILURE;
+ if (!transaction_mode) {
+ goto done_om_finalize;
+ }
+ exit(rc);
+ }
+ objectNames = temp;
objectName = objectNames[objectNames_len - 1] =
malloc(sizeof(SaNameT));
objectNames[objectNames_len++] = NULL;
diff --git a/src/imm/tools/imm_list.c b/src/imm/tools/imm_list.c
index 680bac91f..58ead585c 100644
--- a/src/imm/tools/imm_list.c
+++ b/src/imm/tools/imm_list.c
@@ -103,7 +103,7 @@ static void print_attr_value_raw(SaImmValueTypeT attrValueType,
printf("%llu", *((SaUint64T *)attrValue));
break;
case SA_IMM_ATTR_SATIMET:
- printf("%llu", *((SaTimeT *)attrValue));
+ printf("%lld", *((SaTimeT *)attrValue));
break;
case SA_IMM_ATTR_SAFLOATT:
printf("%.8g", *((SaFloatT *)attrValue));
@@ -168,7 +168,7 @@ static void print_attr_value(SaImmValueTypeT attrValueType,
ctime_r(&time, buf);
buf[strlen(buf) - 1] = '\0'; /* Remove new line */
- printf("%llu (0x%llx, %s)", *((SaTimeT *)attrValue),
+ printf("%lld (0x%llx, %s)", *((SaTimeT *)attrValue),
*((SaTimeT *)attrValue), buf);
break;
}
@@ -412,7 +412,7 @@ static void display_object(const char *name,
char delimiter,
const SaImmAttrNameT *attributeNames)
{
- int i = 0, j;
+ SaUint32T i = 0, j;
SaImmAttrValuesT_2 *attr;
SaNameT objectName;
SaAisErrorT error;
@@ -509,15 +509,27 @@ int main(int argc, char *argv[])
break;
switch (c) {
- case 'a':
- attributeNames = realloc(
+ case 'a': {
+ SaImmAttrNameT *temp = realloc(
attributeNames, ++len * sizeof(SaImmAttrNameT));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ if (attributeNames) {
+ for (int i = 0; i < len - 1; i++) {
+ if (attributeNames[i] != NULL)
+ free(attributeNames[i]);
+ }
+ free(attributeNames);
+ }
+ exit(EXIT_FAILURE);
+ }
+ attributeNames = temp;
attributeNames[len - 2] = strdup(optarg);
attributeNames[len - 1] = NULL;
if (!is_existed_delimiter)
delimiter = ':';
pretty_print = 0;
- break;
+ } break;
case 'c':
class_desc_print = 1;
break;
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-07-17 01:40:50
|
Hi Tai,
ACK from me without comment.
Best Regards,
Thien
________________________________
From: Tai Nguyen <tai...@en...>
Sent: Friday, July 11, 2025 3:02 PM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Thang Nguyen <tha...@en...>
Cc: ope...@li... <ope...@li...>; Tai Nguyen <tai...@en...>
Subject: [PATCH 1/1] amf: Fix coding issue identified by codechecker [#3374]
---
src/amf/amfd/comp.cc | 1 +
src/amf/amfd/csiattr.cc | 1 -
src/amf/amfd/sg_npm_fsm.cc | 7 +++++--
src/amf/amfnd/clc.cc | 1 +
src/amf/amfnd/comp.cc | 2 +-
5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/amf/amfd/comp.cc b/src/amf/amfd/comp.cc
index d5cdb9388..0577674c0 100644
--- a/src/amf/amfd/comp.cc
+++ b/src/amf/amfd/comp.cc
@@ -1717,6 +1717,7 @@ static SaAisErrorT ccb_completed_modify_hdlr(CcbUtilOperationData_t *opdata) {
LOG_WA("Comp modify completed (STDBY): comp does not exist");
return SA_AIS_OK;
}
+ osafassert(comp != nullptr);
while ((attr_mod = opdata->param.modify.attrMods[i++]) != nullptr) {
const SaImmAttrValuesT_2 *attribute = &attr_mod->modAttr;
diff --git a/src/amf/amfd/csiattr.cc b/src/amf/amfd/csiattr.cc
index f52722b39..91a8530c5 100644
--- a/src/amf/amfd/csiattr.cc
+++ b/src/amf/amfd/csiattr.cc
@@ -591,7 +591,6 @@ static void csiattr_modify_apply(CcbUtilOperationData_t *opdata) {
memcpy(tmp_csi_attr->name_value.string_ptr, value, strlen(value) + 1);
osaf_extended_name_alloc(tmp_csi_attr->name_value.string_ptr,
&tmp_csi_attr->name_value.value);
- i = 1;
} else {
for (i = 0; i < attribute->attrValuesNumber; i++) {
char *value = *(char **)attribute->attrValues[i++];
diff --git a/src/amf/amfd/sg_npm_fsm.cc b/src/amf/amfd/sg_npm_fsm.cc
index fad0a4369..c190d920c 100644
--- a/src/amf/amfd/sg_npm_fsm.cc
+++ b/src/amf/amfd/sg_npm_fsm.cc
@@ -3802,13 +3802,16 @@ void SG_NPM::node_fail_su_oper(AVD_CL_CB *cb, AVD_SU *su) {
if (su == su->sg_of_su->max_assigned_su) {
/* Max_assigned_su is assigned quiesced state as part of SI transfer
and the node went down */
+ TRACE("SI transfer failed %s, max_assigned_su '%s'"
+ "min_assigned_su '%s'",
+ su->sg_of_su->si_tobe_redistributed->name.c_str(),
+ su->sg_of_su->max_assigned_su->name.c_str(),
+ su->sg_of_su->min_assigned_su->name.c_str());
su->sg_of_su->max_assigned_su = nullptr;
su->sg_of_su->min_assigned_su = nullptr;
su->sg_of_su->si_tobe_redistributed = nullptr;
m_AVSV_SEND_CKPT_UPDT_ASYNC_RMV(cb, su->sg_of_su,
AVSV_CKPT_AVD_SI_TRANS);
- TRACE("SI transfer failed for SI '%s' as max_assigned_su went down",
- su->sg_of_su->si_tobe_redistributed->name.c_str());
}
}
diff --git a/src/amf/amfnd/clc.cc b/src/amf/amfnd/clc.cc
index 3a196211a..3f9f98cbe 100644
--- a/src/amf/amfnd/clc.cc
+++ b/src/amf/amfnd/clc.cc
@@ -3112,6 +3112,7 @@ uint32_t avnd_comp_clc_cmd_execute(AVND_CB *cb, AVND_COMP *comp,
uint32_t argc = 0, rc = NCSCC_RC_SUCCESS, count = 0;
m_AVND_COMP_CLC_COUNT_AGRC(scr, comp->clc_info.cmds[cmd_type - 1].len, argc);
char *argv[argc + 2];
+ memset(argv, '\0', argc + 2);
unsigned int env_counter;
unsigned int i;
SaStringT env;
diff --git a/src/amf/amfnd/comp.cc b/src/amf/amfnd/comp.cc
index 8c0bf35ff..ad729eb67 100644
--- a/src/amf/amfnd/comp.cc
+++ b/src/amf/amfnd/comp.cc
@@ -2151,7 +2151,7 @@ uint32_t avnd_comp_cbk_send(AVND_CB *cb, AVND_COMP *comp,
/* determine csi name */
if (SA_AMF_CSI_TARGET_ALL != csi_flag)
- csi_name = csi_rec->name.c_str();
+ csi_name = csi_rec->name;
else
csi_name = "";
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-07-08 03:36:25
|
---
src/imm/agent/imma_oi_api.cc | 2 +-
src/imm/agent/imma_om_api.cc | 2 +-
src/imm/apitest/implementer/applier.c | 2 +-
src/imm/apitest/management/populate.c | 2 +-
.../test_saImmConfigSyncrTimeoutImma.c | 4 +-
src/imm/immloadd/imm_pbe_load.cc | 2 +-
src/imm/immnd/ImmModel.cc | 5 +-
src/imm/immnd/immnd_evt.c | 38 +++++-----
src/imm/immnd/immnd_main.c | 23 +++++--
src/imm/immnd/immnd_proc.c | 11 +--
src/imm/tools/imm_admin.c | 18 +++--
src/imm/tools/imm_cfg.c | 69 +++++++++++++++----
src/imm/tools/imm_list.c | 24 +++++--
13 files changed, 137 insertions(+), 65 deletions(-)
diff --git a/src/imm/agent/imma_oi_api.cc b/src/imm/agent/imma_oi_api.cc
index a503e61a5..09b752066 100644
--- a/src/imm/agent/imma_oi_api.cc
+++ b/src/imm/agent/imma_oi_api.cc
@@ -2806,7 +2806,6 @@ mds_send_fail:
}
}
-clm_left:
skip_over_send:
bad_sync:
bad_handle1:
@@ -2839,6 +2838,7 @@ free_obj:
free(p); /*free-2 */
}
+clm_left:
bad_handle:
if (locked) {
m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc
index 30d562b2e..4013bf003 100644
--- a/src/imm/agent/imma_om_api.cc
+++ b/src/imm/agent/imma_om_api.cc
@@ -7732,7 +7732,7 @@ mds_send_fail:
free(req->searchParam.choice.oneAttrParam.attrName.buf); /*free-2 */
req->searchParam.choice.oneAttrParam.attrName.buf = NULL;
req->searchParam.choice.oneAttrParam.attrName.size = 0;
- if (searchParam->searchOneAttr.attrValue) { /*free-3 */
+ if (searchParam && searchParam->searchOneAttr.attrValue) { /*free-3 */
immsv_evt_free_att_val(&(req->searchParam.choice.oneAttrParam.attrValue),
searchParam->searchOneAttr.attrValueType);
}
diff --git a/src/imm/apitest/implementer/applier.c b/src/imm/apitest/implementer/applier.c
index 12cc755d6..566532b3c 100644
--- a/src/imm/apitest/implementer/applier.c
+++ b/src/imm/apitest/implementer/applier.c
@@ -213,7 +213,7 @@ static void saImmOiAdminOperationCallback(
SaAisErrorT err =
immutil_saImmOiAdminOperationResult(immOiHandle, invocation, SA_AIS_OK);
if (err != SA_AIS_OK) {
- fprintf(stderr, "Reply on admin operation failed, err:%u\n",
+ fprintf(stderr, "Reply on admin operation failed, err:%d\n",
err);
}
}
diff --git a/src/imm/apitest/management/populate.c b/src/imm/apitest/management/populate.c
index 28fea28bf..c634a482c 100644
--- a/src/imm/apitest/management/populate.c
+++ b/src/imm/apitest/management/populate.c
@@ -172,7 +172,7 @@ static range_obj_t *gen_pop_tree(unsigned int level, range_obj_t *rootObj,
if (reminder) {
fprintf(stderr,
- "error - Returning with nonzero reminder r:%u ix:%u\n",
+ "error - Returning with nonzero reminder r:%u ix:%d\n",
reminder, ix);
abort();
}
diff --git a/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c b/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c
index 039b7e279..0cf5f09e7 100644
--- a/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c
+++ b/src/imm/apitest/management/test_saImmConfigSyncrTimeoutImma.c
@@ -37,12 +37,12 @@ static int get_pid_immnd()
if (fscanf(f, "%d", &pid) == 0) {
fprintf(stderr, "Could not read PID from file %s\n",
osafimmnd_pid_file);
- return -1;
+ pid = -1;
}
if (fclose(f) != 0) {
fprintf(stderr, "Could not close file\n");
- return -1;
+ pid = -1;
}
return pid;
}
diff --git a/src/imm/immloadd/imm_pbe_load.cc b/src/imm/immloadd/imm_pbe_load.cc
index 3fd9fde5c..a5b0e6e73 100644
--- a/src/imm/immloadd/imm_pbe_load.cc
+++ b/src/imm/immloadd/imm_pbe_load.cc
@@ -254,7 +254,7 @@ bool loadClassFromPbe(void *pbeHandle, SaImmHandleT immHandle,
SaImmAttrFlagsT attrFlags = 0LL;
SaImmAttrValueT attDflt = NULL;
char buf[32];
- snprintf(buf, 32, "Row(%u): <", ++r);
+ snprintf(buf, 32, "Row(%d): <", ++r);
std::string rowStr(buf);
AttrInfo *attr_info = NULL;
char *val;
diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index 0caf5f11e..d0add57d8 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -5402,7 +5402,7 @@ SaAisErrorT ImmModel::adminOwnerChange(const struct immsv_a2nd_admown_set* req,
if (i2 != sCcbVector.end() && (*i2)->isActive()) {
std::string oldOwner;
objectInfo->getAdminOwnerName(&oldOwner);
- if (!release && (adm->mAdminOwnerName == oldOwner)) {
+ if (!release && adm && adm->mAdminOwnerName == oldOwner) {
TRACE("Idempotent adminOwner set for %s on %s",
oldOwner.c_str(), objectName.c_str());
} else if (!release && oldOwner.empty()
@@ -5447,7 +5447,8 @@ SaAisErrorT ImmModel::adminOwnerChange(const struct immsv_a2nd_admown_set* req,
if (i2 != sCcbVector.end() && (*i2)->isActive()) {
std::string oldOwner;
subObj->getAdminOwnerName(&oldOwner);
- if (!release && adm->mAdminOwnerName == oldOwner) {
+ if (!release && adm &&
+ adm->mAdminOwnerName == oldOwner) {
TRACE("Idempotent adminOwner set for %s on %s",
oldOwner.c_str(), subObjName.c_str());
} else {
diff --git a/src/imm/immnd/immnd_evt.c b/src/imm/immnd/immnd_evt.c
index 99e9452ef..46cb85b31 100644
--- a/src/imm/immnd/immnd_evt.c
+++ b/src/imm/immnd/immnd_evt.c
@@ -4718,7 +4718,7 @@ static void immnd_evt_proc_ccb_compl_rsp(IMMND_CB *cb, IMMND_EVT *evt,
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation =
applCtn;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
SaImmOiHandleT implHandle =
@@ -4806,7 +4806,7 @@ static void immnd_evt_proc_ccb_compl_rsp(IMMND_CB *cb, IMMND_EVT *evt,
}
if (arrSize) {
- int ix;
+ unsigned int ix;
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type =
@@ -4873,7 +4873,7 @@ static void immnd_evt_proc_ccb_compl_rsp(IMMND_CB *cb, IMMND_EVT *evt,
evt->info.ccbUpcallRsp.ccbId;
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation = 0;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
SaImmOiHandleT implHandle =
@@ -5490,7 +5490,7 @@ static void immnd_evt_pbe_rt_obj_deletes_rsp(IMMND_CB *cb, IMMND_EVT *evt,
noreply:
if (spApplConn && (evt->info.ccbUpcallRsp.result == SA_AIS_OK)) {
- int ix = 0;
+ unsigned int ix = 0;
SaImmHandleT tmp_hdl =
m_IMMSV_PACK_HANDLE(spApplConn, cb->node_id);
/*Fetch client node for Special applier OI */
@@ -5531,7 +5531,7 @@ noreply:
done:
if (arrSize) {
- int ix;
+ unsigned int ix;
for (ix = 0; ix < arrSize; ++ix) {
free(objNameArr[ix]);
}
@@ -7307,7 +7307,7 @@ static void immnd_evt_proc_object_create(IMMND_CB *cb, IMMND_EVT *evt,
/* Re-use the adminOwner member of the ccbCreate message
to hold the invocation id. In this case, 0 => no reply
is expected. */
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
implHandle = m_IMMSV_PACK_HANDLE(
applConnArr[ix], cb->node_id);
@@ -7615,7 +7615,7 @@ static void immnd_evt_proc_object_modify(IMMND_CB *cb, IMMND_EVT *evt,
/* Re-use the adminOwner member of the ccbModify message
to hold the invocation id. In this case, 0 => no reply
is expected. */
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
bool isSpecialApplier = false;
send_evt.info.imma.info.objModify.attrMods =
@@ -8168,7 +8168,7 @@ static void immnd_evt_ccb_abort(IMMND_CB *cb, SaUint32T ccbId,
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type = IMMA_EVT_ND2A_OI_CCB_ABORT_UC;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize; ++ix) {
/*Look up the client node for the implementer, using
* implConn */
@@ -8215,7 +8215,7 @@ static void immnd_evt_ccb_abort(IMMND_CB *cb, SaUint32T ccbId,
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type = IMMA_EVT_ND2A_OI_CCB_ABORT_UC;
send_evt.info.imma.info.ccbCompl.ccbId = ccbId;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize; ++ix) {
SaImmOiHandleT implHandle =
m_IMMSV_PACK_HANDLE(applConnArr[ix], cb->node_id);
@@ -8427,7 +8427,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
: IMMA_EVT_ND2A_OI_OBJ_DELETE_UC;
send_evt.info.imma.info.objDelete.ccbId =
evt->info.objDelete.ccbId;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
if (implConnArr[ix] == 0) {
/* implConn zero => ony for PBE or
@@ -8528,7 +8528,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
/* Re-use the adminOwner member of the ccbDelete message to hold
the invocation id. In this case, 0 => no reply is expected.
*/
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK;
++ix) { /* Iterate over deleted objects */
SaUint32T *applConnArr = NULL;
@@ -8543,7 +8543,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
cb, &objName, evt->info.objDelete.ccbId,
&applConnArr, true);
- int ix2 = 0;
+ unsigned int ix2 = 0;
for (; ix2 < arrSize2 && err == SA_AIS_OK;
++ix2) { /* Iterate over applier connections for
object */
@@ -8661,7 +8661,7 @@ static void immnd_evt_proc_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
}
if (arrSize) {
- int ix;
+ unsigned int ix;
free(implConnArr);
implConnArr = NULL;
free(invocArr);
@@ -8921,7 +8921,7 @@ static void immnd_evt_proc_rt_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
}
if (spApplConn && (err == SA_AIS_OK) && !delayedReply) {
- int ix = 0;
+ unsigned int ix = 0;
/* Indicates object is marked with SA_IMM_ATTR_NOTIFY and
special applier is present at this node and we dont need to
wait for ack from PBE (non persistent RTO or PBE not
@@ -8963,7 +8963,7 @@ static void immnd_evt_proc_rt_object_delete(IMMND_CB *cb, IMMND_EVT *evt,
done:
if (arrSize) {
- int ix;
+ unsigned int ix;
for (ix = 0; ix < arrSize; ++ix) {
free(objNameArr[ix]);
}
@@ -9201,7 +9201,7 @@ static void immnd_evt_proc_ccb_apply(IMMND_CB *cb, IMMND_EVT *evt,
send_evt.type = IMMSV_EVT_TYPE_IMMA;
send_evt.info.imma.type =
IMMA_EVT_ND2A_OI_CCB_COMPLETED_UC;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < arrSize && err == SA_AIS_OK; ++ix) {
/*Look up the client node for the implementer,
@@ -9431,7 +9431,7 @@ skip_send:
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation =
applCtn;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
implHandle = m_IMMSV_PACK_HANDLE(
@@ -9514,7 +9514,7 @@ skip_send:
evt->info.ccbId;
send_evt.info.imma.info.ccbCompl.implId = 0;
send_evt.info.imma.info.ccbCompl.invocation = 0;
- int ix = 0;
+ unsigned int ix = 0;
for (; ix < applArrSize && err == SA_AIS_OK;
++ix) {
implHandle = m_IMMSV_PACK_HANDLE(
@@ -10214,7 +10214,7 @@ uint32_t immnd_evt_proc_pbe_prto_purge_mutations(IMMND_CB *cb, IMMND_EVT *evt,
uint32_t rc = NCSCC_RC_SUCCESS;
IMMSV_EVT send_evt;
IMMND_IMM_CLIENT_NODE *cl_node = NULL;
- int ix = 0;
+ unsigned int ix = 0;
osafassert(reqConnArr);
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMA;
diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c
index 50bbb57ec..30d504b56 100644
--- a/src/imm/immnd/immnd_main.c
+++ b/src/imm/immnd/immnd_main.c
@@ -148,23 +148,36 @@ static char** parse_reserved_class_names(const char* input)
LOG_ER("The reserved name `%s` is invalid!", token);
goto freedata;
}
- result = (char**)realloc(result, sizeof(char*) * ++n_elements);
+ char **temp =
+ (char **)realloc(result, sizeof(char *) * ++n_elements);
+ if (temp == NULL) {
+ LOG_ER("Memory allocation failed during realloc!");
+ goto freedata;
+ }
+ result = temp;
result[n_elements - 1] = strdup(token);
token = strsep(&dup, ",");
}
- result = (char**)realloc(result, sizeof(char*) * (n_elements + 1));
+ char **temp = (char**)realloc(result, sizeof(char*) * (n_elements + 1));
+ if (temp == NULL) {
+ LOG_ER("Final realloc failed!");
+ goto freedata;
+ }
+ result = temp;
result[n_elements] = 0;
free(tofree);
return result;
freedata:
- for (i = 0; i < n_elements; i++) {
- if (result[i]) free(result[i]);
+ if (result != NULL) {
+ for (i = 0; i < n_elements; i++) {
+ if (result[i]) free(result[i]);
+ }
+ free(result);
}
free(tofree);
- free(result);
return NULL;
}
diff --git a/src/imm/immnd/immnd_proc.c b/src/imm/immnd/immnd_proc.c
index 5df703799..3fa856d98 100644
--- a/src/imm/immnd/immnd_proc.c
+++ b/src/imm/immnd/immnd_proc.c
@@ -893,8 +893,9 @@ void immnd_adjustEpoch(IMMND_CB *cb, bool increment)
*/
}
- int newEpoch = immModel_adjustEpoch(cb, cb->mMyEpoch, &continuationId,
- &pbeConn, pbeNodeIdPtr, increment);
+ SaUint32T newEpoch =
+ immModel_adjustEpoch(cb, cb->mMyEpoch, &continuationId, &pbeConn,
+ pbeNodeIdPtr, increment);
if (newEpoch != cb->mMyEpoch) {
/*This case only relevant when persistent epoch overrides
last epoch, i.e. after reload at cluster start. */
@@ -1424,8 +1425,8 @@ static void immnd_cleanTheHouse(IMMND_CB *cb, bool iAmCoordNow)
&oi_cl_node);
osafassert(oi_cl_node);
osafassert(!(oi_cl_node->mIsStale));
- for (int ix = 0; ix < ccbIdArrSize;
- ++ix) {
+ for (unsigned int ix = 0;
+ ix < ccbIdArrSize; ++ix) {
TRACE_2(
"Fetch ccb outcome for ccb%u, nodeId:%u, conn:%u implId:%u",
ccbIdArr[ix], pbeNodeId,
@@ -1723,7 +1724,7 @@ static bool immnd_ccbsTerminated(IMMND_CB *cb, SaUint32T duration,
memset(&send_evt, '\0', sizeof(IMMSV_EVT));
send_evt.type = IMMSV_EVT_TYPE_IMMD;
send_evt.info.immd.type = IMMD_EVT_ND2D_ABORT_CCB;
- int ix;
+ unsigned int ix;
immModel_getNonCriticalCcbs(cb, &ccbIdArr, &ccbIdArrSize);
for (ix = 0; ix < ccbIdArrSize; ++ix) {
diff --git a/src/imm/tools/imm_admin.c b/src/imm/tools/imm_admin.c
index 1d908f53e..8e5c5d793 100644
--- a/src/imm/tools/imm_admin.c
+++ b/src/imm/tools/imm_admin.c
@@ -211,7 +211,7 @@ void print_param(SaImmAdminOperationParamsT_2 *param)
ctime_r(&time, buf);
buf[strlen(buf) - 1] = '\0'; /* Remove new line */
- printf("%-50s %-12s %llu (0x%llx, %s)\n", param->paramName,
+ printf("%-50s %-12s %lld (0x%llx, %s)\n", param->paramName,
"SA_TIME_T", (*((SaTimeT *)param->paramBuffer)),
(*((SaTimeT *)param->paramBuffer)), buf);
} break;
@@ -328,7 +328,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
break;
- case 'O':
+ case 'O': {
if (operationId != -1) {
fprintf(
stderr,
@@ -337,9 +337,15 @@ int main(int argc, char *argv[])
}
operationId = SA_IMM_PARAM_ADMOP_ID_ESC;
params_len++;
- params = realloc(
+ const SaImmAdminOperationParamsT_2 **tmp = realloc(
params, (params_len + 1) *
sizeof(SaImmAdminOperationParamsT_2 *));
+ if (tmp == NULL){
+ fprintf(stderr, "realloc() error");
+ if (params) free(params);
+ exit(EXIT_FAILURE);
+ }
+ params = tmp;
param = malloc(sizeof(SaImmAdminOperationParamsT_2));
params[params_len - 1] = param;
params[params_len] = NULL;
@@ -348,8 +354,8 @@ int main(int argc, char *argv[])
param->paramBuffer = malloc(sizeof(SaStringT));
*((SaStringT *)(param->paramBuffer)) = strdup(optarg);
opName = strdup(optarg);
- break;
- case 'p':
+ } break;
+ case 'p': {
params_len++;
const SaImmAdminOperationParamsT_2 **tmp = realloc(
params, (params_len + 1) *
@@ -368,7 +374,7 @@ int main(int argc, char *argv[])
optarg);
exit(EXIT_FAILURE);
}
- break;
+ } break;
case 't':
timeoutVal = strtoll(optarg, (char **)NULL, 10);
diff --git a/src/imm/tools/imm_cfg.c b/src/imm/tools/imm_cfg.c
index 24648e692..69fb371bc 100644
--- a/src/imm/tools/imm_cfg.c
+++ b/src/imm/tools/imm_cfg.c
@@ -241,7 +241,7 @@ static void free_attr_value(SaImmValueTypeT attrValueType,
static void free_attr_values(SaImmAttrValuesT_2 *attrValues)
{
- int i;
+ SaUint32T i;
if (attrValues) {
free(attrValues->attrName);
@@ -257,7 +257,7 @@ static void free_attr_values(SaImmAttrValuesT_2 *attrValues)
static void free_attr_mod(SaImmAttrModificationT_2 *attrMod)
{
- int i;
+ SaUint32T i;
if (attrMod) {
if (attrMod->modAttr.attrName)
free(attrMod->modAttr.attrName);
@@ -594,10 +594,15 @@ int object_create(const SaNameT **objectNames, const SaImmClassNameT className,
}
}
if (!attrAdded) {
-
- attrValues = realloc(attrValues,
- (attr_len + 1) *
- sizeof(SaImmAttrValuesT_2 *));
+ SaImmAttrValuesT_2 **temp = NULL;
+ temp = realloc(attrValues,
+ (attr_len + 1) *
+ sizeof(SaImmAttrValuesT_2 *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ goto done;
+ }
+ attrValues = temp;
attrValues[attr_len - 1] = attrValue;
attrValues[attr_len] = NULL;
attr_len++;
@@ -845,9 +850,15 @@ int object_modify(const SaNameT **objectNames, char **optargs, int optargs_len)
}
if (!attrAdded) {
- attrMods = realloc(
- attrMods, (attr_len + 1) *
- sizeof(SaImmAttrModificationT_2 *));
+ SaImmAttrModificationT_2 **temp = NULL;
+ temp = realloc(attrMods,
+ (attr_len + 1) *
+ sizeof(SaImmAttrModificationT_2 *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ goto done;
+ }
+ attrMods = temp;
attrMods[attr_len - 1] = attrMod;
attrMods[attr_len] = NULL;
attr_len++;
@@ -1766,11 +1777,17 @@ static int imm_operation(int argc, char *argv[])
strictParse = 1;
}
break;
- case 'a':
- optargs =
+ case 'a': {
+ char **temp = NULL;
+ temp =
realloc(optargs, ++optargs_len * sizeof(char *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ exit(EXIT_FAILURE);
+ }
+ optargs = temp;
optargs[optargs_len - 1] = strdup(optarg);
- break;
+ } break;
case 'c':
className = optarg;
op = verify_setoption(op, CREATE_OBJECT);
@@ -1933,10 +1950,23 @@ static int imm_operation(int argc, char *argv[])
}
if (op == DELETE_CLASS) {
+ SaImmClassNameT *temp = NULL;
while (optind < argc) {
- classNames =
+ temp =
realloc(classNames, (classNames_len + 1) *
sizeof(SaImmClassNameT *));
+ if (temp == NULL) {
+ fprintf(stderr, "operation DELETE_CLASS - "
+ "realloc failed\n");
+ if (classNames)
+ free(classNames);
+ rc = EXIT_FAILURE;
+ if (!transaction_mode) {
+ goto done_om_finalize;
+ }
+ exit(rc);
+ }
+ classNames = temp;
classNames[classNames_len - 1] =
((SaImmClassNameT)argv[optind++]);
classNames[classNames_len++] = NULL;
@@ -1979,10 +2009,19 @@ static int imm_operation(int argc, char *argv[])
goto done_om_finalize;
}
} else {
+ SaNameT **temp = NULL;
while (optind < argc) {
- objectNames =
- realloc(objectNames,
+ temp = realloc(objectNames,
(objectNames_len + 1) * sizeof(SaNameT *));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc failed\n");
+ rc = EXIT_FAILURE;
+ if (!transaction_mode) {
+ goto done_om_finalize;
+ }
+ exit(rc);
+ }
+ objectNames = temp;
objectName = objectNames[objectNames_len - 1] =
malloc(sizeof(SaNameT));
objectNames[objectNames_len++] = NULL;
diff --git a/src/imm/tools/imm_list.c b/src/imm/tools/imm_list.c
index 680bac91f..58ead585c 100644
--- a/src/imm/tools/imm_list.c
+++ b/src/imm/tools/imm_list.c
@@ -103,7 +103,7 @@ static void print_attr_value_raw(SaImmValueTypeT attrValueType,
printf("%llu", *((SaUint64T *)attrValue));
break;
case SA_IMM_ATTR_SATIMET:
- printf("%llu", *((SaTimeT *)attrValue));
+ printf("%lld", *((SaTimeT *)attrValue));
break;
case SA_IMM_ATTR_SAFLOATT:
printf("%.8g", *((SaFloatT *)attrValue));
@@ -168,7 +168,7 @@ static void print_attr_value(SaImmValueTypeT attrValueType,
ctime_r(&time, buf);
buf[strlen(buf) - 1] = '\0'; /* Remove new line */
- printf("%llu (0x%llx, %s)", *((SaTimeT *)attrValue),
+ printf("%lld (0x%llx, %s)", *((SaTimeT *)attrValue),
*((SaTimeT *)attrValue), buf);
break;
}
@@ -412,7 +412,7 @@ static void display_object(const char *name,
char delimiter,
const SaImmAttrNameT *attributeNames)
{
- int i = 0, j;
+ SaUint32T i = 0, j;
SaImmAttrValuesT_2 *attr;
SaNameT objectName;
SaAisErrorT error;
@@ -509,15 +509,27 @@ int main(int argc, char *argv[])
break;
switch (c) {
- case 'a':
- attributeNames = realloc(
+ case 'a': {
+ SaImmAttrNameT *temp = realloc(
attributeNames, ++len * sizeof(SaImmAttrNameT));
+ if (temp == NULL) {
+ fprintf(stderr, "realloc() error");
+ if (attributeNames) {
+ for (int i = 0; i < len - 1; i++) {
+ if (attributeNames[i] != NULL)
+ free(attributeNames[i]);
+ }
+ free(attributeNames);
+ }
+ exit(EXIT_FAILURE);
+ }
+ attributeNames = temp;
attributeNames[len - 2] = strdup(optarg);
attributeNames[len - 1] = NULL;
if (!is_existed_delimiter)
delimiter = ':';
pretty_print = 0;
- break;
+ } break;
case 'c':
class_desc_print = 1;
break;
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-07-08 03:36:23
|
Summary: imm: Fix coding issues identified by Codechecker [#3376] Review request for Ticket(s): 3376 Peer Reviewer(s): Thang, Dat, Tai Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3376 Base revision: 6349a66032ea53f2b1757be2a80ed4e972f5733f Personal repository: git://git.code.sf.net/u/thienhuynh/review -------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision d04b619a01dfa8b1749e2463a72f34f24c7ecdd6 Author: thien.m.huynh <thi...@en...> Date: Tue, 8 Jul 2025 10:19:58 +0700 imm: Fix coding issues identified by Codechecker [#3376] Complete diffstat: ------------------ src/imm/agent/imma_oi_api.cc | 2 +- src/imm/agent/imma_om_api.cc | 2 +- src/imm/apitest/implementer/applier.c | 2 +- src/imm/apitest/management/populate.c | 2 +- .../management/test_saImmConfigSyncrTimeoutImma.c | 4 +- src/imm/immloadd/imm_pbe_load.cc | 2 +- src/imm/immnd/ImmModel.cc | 5 +- src/imm/immnd/immnd_evt.c | 38 ++++++------ src/imm/immnd/immnd_main.c | 23 ++++++-- src/imm/immnd/immnd_proc.c | 11 ++-- src/imm/tools/imm_admin.c | 18 ++++-- src/imm/tools/imm_cfg.c | 69 +++++++++++++++++----- src/imm/tools/imm_list.c | 24 ++++++-- 13 files changed, 137 insertions(+), 65 deletions(-) Testing Commands: ----------------- N/A Testing, Expected Results: -------------------------- N/A Conditions of Submission: ------------------------- ACK from reviewers Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y 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 ~/.gitconfig file (i.e. user.name, user.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. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-07-03 03:35:02
|
Hi Thang, ACK without comment. Best Regards, Thien ________________________________ From: Thang Nguyen <tha...@en...> Sent: Thursday, May 15, 2025 8:30 AM To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Tai Nguyen <tai...@en...> Cc: ope...@li... <ope...@li...>; Thang Nguyen <tha...@en...> Subject: [PATCH 1/1] pyosaf: support python 3.10+ [#3372] >From Python 3.10 and later, several abstract base classes (ABCs) like Iterable, Iterator, Mapping, Sequence, etc. were fully removed from the main collections module. These classes were moved to collections.abc in Python 3.3. Should adapt it to support on all python version. --- python/pyosaf/utils/immom/iterator.py | 5 ++++- python/pyosaf/utils/ntf/reader.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python/pyosaf/utils/immom/iterator.py b/python/pyosaf/utils/immom/iterator.py index 7b0e0a8a4..0d545ab31 100644 --- a/python/pyosaf/utils/immom/iterator.py +++ b/python/pyosaf/utils/immom/iterator.py @@ -17,7 +17,10 @@ ############################################################################ """ IMM Search iterators """ from __future__ import print_function -from collections import Iterator +try: + from collections.abc import Iterator # Python 3.3+ +except ImportError: + from collections import Iterator # For older versions from ctypes import pointer, cast, c_void_p from pyosaf.saAis import eSaAisErrorT, SaNameT, unmarshalNullArray, SaStringT diff --git a/python/pyosaf/utils/ntf/reader.py b/python/pyosaf/utils/ntf/reader.py index b6334822a..7c94638ef 100644 --- a/python/pyosaf/utils/ntf/reader.py +++ b/python/pyosaf/utils/ntf/reader.py @@ -15,7 +15,10 @@ # ############################################################################ """ NTF reader utilities """ -from collections import Iterator +try: + from collections.abc import Iterator # Python 3.3+ +except ImportError: + from collections import Iterator # For older versions from pyosaf import saNtf from pyosaf.saAis import eSaAisErrorT from pyosaf.utils import log_err, bad_handle_retry -- 2.25.1 The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-06-27 03:00:10
|
---
src/smf/agent/smfa_utils.c | 8 ++---
src/smf/smfd/SmfCampState.cc | 4 +--
src/smf/smfd/SmfCampaignWrapup.cc | 7 +++--
src/smf/smfd/SmfImmOperation.h | 2 +-
src/smf/smfd/SmfUpgradeCampaign.cc | 12 ++++----
src/smf/smfd/SmfUpgradeProcedure.cc | 48 +++++++++++++++++++----------
6 files changed, 49 insertions(+), 32 deletions(-)
diff --git a/src/smf/agent/smfa_utils.c b/src/smf/agent/smfa_utils.c
index d9c7cbe6c..550bedaaf 100644
--- a/src/smf/agent/smfa_utils.c
+++ b/src/smf/agent/smfa_utils.c
@@ -379,8 +379,8 @@ uint32_t smfa_cbk_ok_resp_process(SaSmfHandleT smfHandle,
hdl_prev->next_hdl =
hdl_list->next_hdl;
/* Head node deleted.*/
- if ((hdl_list->hdl ==
- hdl_prev->hdl)) {
+ if (hdl_list->hdl ==
+ hdl_prev->hdl) {
cbk_list->hdl_list =
hdl_prev->next_hdl;
/* No more resp
@@ -417,7 +417,7 @@ uint32_t smfa_cbk_ok_resp_process(SaSmfHandleT smfHandle,
rmv_inv:
cbk_prev->next_cbk = cbk_list->next_cbk;
/* Last inv node.*/
- if ((cbk_list->inv_id == cbk_prev->inv_id)) {
+ if (cbk_list->inv_id == cbk_prev->inv_id) {
cb->cbk_list = cbk_prev->next_cbk;
}
free(cbk_list);
@@ -479,7 +479,7 @@ uint32_t smfa_cbk_err_resp_process(SaInvocationT invocation, SaSmfHandleT hdl)
rmv_inv:
cbk_prev->next_cbk = cbk_list->next_cbk;
/* Last inv node.*/
- if ((cbk_list->inv_id == cbk_prev->inv_id)) {
+ if (cbk_list->inv_id == cbk_prev->inv_id) {
cb->cbk_list = cbk_prev->next_cbk;
}
free(cbk_list);
diff --git a/src/smf/smfd/SmfCampState.cc b/src/smf/smfd/SmfCampState.cc
index 8f62fb0bc..0667bb1cd 100644
--- a/src/smf/smfd/SmfCampState.cc
+++ b/src/smf/smfd/SmfCampState.cc
@@ -375,7 +375,7 @@ SmfCampResultT SmfCampStateInitial::executeInit(SmfUpgradeCampaign *i_camp) {
TRACE_ENTER();
TRACE("SmfCampStateExecuting::executeInit, Running campaign init actions");
- if (i_camp->m_campInit.execute() != SA_AIS_OK) {
+ if (!i_camp->m_campInit.execute()) {
std::string error = "Campaign init failed";
LOG_ER("%s", error.c_str());
SmfCampaignThread::instance()->campaign()->setError(error);
@@ -1847,7 +1847,7 @@ SmfCampResultT SmfCampRollingBack::rollbackInit(SmfUpgradeCampaign *i_camp) {
// succeeds. Write the same value, just for synchronization purposes.
changeState(i_camp, SmfCampRollingBack::instance());
- if (i_camp->m_campInit.rollback() != SA_AIS_OK) {
+ if (!i_camp->m_campInit.rollback()) {
std::string error = "Campaign init rollback failed";
LOG_ER("%s", error.c_str());
SmfCampaignThread::instance()->campaign()->setError(error);
diff --git a/src/smf/smfd/SmfCampaignWrapup.cc b/src/smf/smfd/SmfCampaignWrapup.cc
index 8f5646424..52e887aeb 100644
--- a/src/smf/smfd/SmfCampaignWrapup.cc
+++ b/src/smf/smfd/SmfCampaignWrapup.cc
@@ -182,8 +182,11 @@ bool SmfCampaignWrapup::rollbackCampWrapup() {
LOG_NO("CAMP: Campaign wrapup, rollback wrapup actions (%zu)",
m_campWrapupAction.size());
for (auto& elem : m_campWrapupAction) {
- SmfImmCcbAction* immCcb = NULL;
- if ((immCcb = dynamic_cast<SmfImmCcbAction*>(elem)) != NULL) {
+ if (!elem) {
+ TRACE("SmfCampaignWrapup rollback campWrapupAction skip");
+ continue;
+ }
+ if (dynamic_cast<SmfImmCcbAction*>(elem)) {
/* Since noone of these IMM CCB has been executed it's no point
in trying to roll them back */
TRACE("SmfCampaignWrapup skipping immCcb rollback %d", (*elem).getId());
diff --git a/src/smf/smfd/SmfImmOperation.h b/src/smf/smfd/SmfImmOperation.h
index ae537b820..a7cf80129 100644
--- a/src/smf/smfd/SmfImmOperation.h
+++ b/src/smf/smfd/SmfImmOperation.h
@@ -135,7 +135,7 @@ class SmfImmOperation {
// get the correct operation descriptor
enum OperationType { NotSet, Create, Delete, Modify };
- const OperationType GetOperationType() { return imm_operation_; }
+ OperationType GetOperationType() const { return imm_operation_; }
const modelmodify::CreateDescriptor GetCreateDescriptor() {
return object_create_;
}
diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc b/src/smf/smfd/SmfUpgradeCampaign.cc
index 4a1591abb..ac0dd6bf2 100644
--- a/src/smf/smfd/SmfUpgradeCampaign.cc
+++ b/src/smf/smfd/SmfUpgradeCampaign.cc
@@ -447,7 +447,7 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) {
TRACE_ENTER();
SaAisErrorT rc = SA_AIS_OK;
SaImmAttrValuesT_2 **attributes;
- int curCnt = 0;
+ SaUint32T curCnt = 0;
/* Read the SmfCampRestartInfo object smfCampRestartCnt attr */
std::string obj = "smfRestartInfo=info," +
@@ -472,8 +472,8 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) {
SmfImmAttribute attrsmfCampRestartCnt;
attrsmfCampRestartCnt.SetAttributeName("smfCampRestartCnt");
attrsmfCampRestartCnt.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- char buf[5];
- snprintf(buf, 4, "%u", curCnt);
+ char buf[11] = {};
+ snprintf(buf, sizeof(buf), "%u", curCnt);
attrsmfCampRestartCnt.AddAttributeValue(buf);
imoCampRestartInfo.AddValue(attrsmfCampRestartCnt);
@@ -484,8 +484,8 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) {
}
}
- int maxCnt = smfd_cb->smfCampMaxRestart;
- TRACE("maxCnt=%d, curCnt=%d", maxCnt, curCnt);
+ SaUint32T maxCnt = smfd_cb->smfCampMaxRestart;
+ TRACE("maxCnt=%u, curCnt=%u", maxCnt, curCnt);
if (curCnt > maxCnt) {
TRACE("TRUE");
*o_result = true;
@@ -1035,7 +1035,7 @@ void SmfUpgradeCampaign::resetMaintenanceState() {
uint32_t retry_cnt = 0;
while (++retry_cnt <= MAX_NO_RETRIES) {
rc = immUtil.doImmOperations(operations);
- if (rc != SA_AIS_OK && rc == SA_AIS_ERR_TRY_AGAIN) {
+ if (rc == SA_AIS_ERR_TRY_AGAIN) {
/*
* TRY_AGAIN is returned only when ccb is aborted
* with Resource abort in error string.
diff --git a/src/smf/smfd/SmfUpgradeProcedure.cc b/src/smf/smfd/SmfUpgradeProcedure.cc
index fae0af596..0787e928a 100644
--- a/src/smf/smfd/SmfUpgradeProcedure.cc
+++ b/src/smf/smfd/SmfUpgradeProcedure.cc
@@ -1268,9 +1268,13 @@ bool SmfUpgradeProcedure::mergeStepIntoSingleStep(SmfUpgradeProcedure *i_proc,
LOG_NO("Copy the procedure init actions");
i_proc->addInitActions((*proc_elem).getInitActions());
for (const auto &actionElem : i_proc->getInitActions()) {
+ if (!actionElem) {
+ TRACE("Procedure init action %d skip", initActionId);
+ continue;
+ }
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actionElem);
- if (cbkAction != NULL) {
+ if (cbkAction) {
const_cast<SmfCallbackAction *>(cbkAction)->setCallbackProcedure(this);
}
// Renumber to action id aviod DN name collision in the merged procedure
@@ -1282,9 +1286,13 @@ bool SmfUpgradeProcedure::mergeStepIntoSingleStep(SmfUpgradeProcedure *i_proc,
LOG_NO("Copy the procedure wrapup actions");
i_proc->addWrapupActions((*proc_elem).getWrapupActions());
for (const auto &actionElem : i_proc->getWrapupActions()) {
+ if (!actionElem) {
+ TRACE("Procedure wrapup action %d skip", wrapupActionId);
+ continue;
+ }
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actionElem);
- if (cbkAction != NULL) {
+ if (cbkAction) {
const_cast<SmfCallbackAction *>(cbkAction)->setCallbackProcedure(this);
}
// Renumber to action id aviod DN name collision in the merged procedure
@@ -2656,8 +2664,7 @@ SaAisErrorT SmfUpgradeProcedure::createImmStep(SmfUpgradeStep *i_step) {
TRACE_ENTER();
std::string dnDeactUnit = "safSmfDu=smfDeactivationUnit";
std::string dnActUnit = "safSmfAu=smfActivationUnit";
- int strSize = 64;
- char str[strSize];
+ char str[11] = {};
/* Create the SaSmfStep object */
SmfImmRTCreateOperation icoSaSmfStep;
@@ -2674,28 +2681,28 @@ SaAisErrorT SmfUpgradeProcedure::createImmStep(SmfUpgradeStep *i_step) {
SmfImmAttribute attrsaSmfStepMaxRetry;
attrsaSmfStepMaxRetry.SetAttributeName("saSmfStepMaxRetry");
attrsaSmfStepMaxRetry.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getMaxRetry());
+ snprintf(str, sizeof(str), "%u", i_step->getMaxRetry());
attrsaSmfStepMaxRetry.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepMaxRetry);
SmfImmAttribute attrsaSmfStepRetryCount;
attrsaSmfStepRetryCount.SetAttributeName("saSmfStepRetryCount");
attrsaSmfStepRetryCount.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getRetryCount());
+ snprintf(str, sizeof(str), "%u", i_step->getRetryCount());
attrsaSmfStepRetryCount.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepRetryCount);
SmfImmAttribute attrsaSmfStepRestartOption;
attrsaSmfStepRestartOption.SetAttributeName("saSmfStepRestartOption");
attrsaSmfStepRestartOption.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getRestartOption());
+ snprintf(str, sizeof(str), "%u", i_step->getRestartOption());
attrsaSmfStepRestartOption.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepRestartOption);
SmfImmAttribute attrsaSmfStepState;
attrsaSmfStepState.SetAttributeName("saSmfStepState");
attrsaSmfStepState.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getState());
+ snprintf(str, sizeof(str), "%d", i_step->getState());
attrsaSmfStepState.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepState);
@@ -3350,9 +3357,6 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
std::list<std::string> stepList;
TRACE_ENTER();
- SmfUpgradeStep *newStep = new (std::nothrow) SmfUpgradeStep;
- osafassert(newStep != NULL);
-
// Read the single step from IMM
if (immutil.getChildren(getDn(), stepList, SA_IMM_SUBLEVEL, "SaSmfStep") ==
false) {
@@ -3375,6 +3379,9 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
return SA_AIS_ERR_NOT_EXIST;
}
+ SmfUpgradeStep *newStep = new (std::nothrow) SmfUpgradeStep;
+ osafassert(newStep != NULL);
+
TRACE("Copy step basic data from IMM into the new merged step.");
if (newStep->init((const SaImmAttrValuesT_2 **)attributes) != SA_AIS_OK) {
LOG_NO(
@@ -3409,7 +3416,7 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
if (newStep->getState() == SA_SMF_STEP_INITIAL) {
mergeStepIntoSingleStep(this,
newStep); // Just merge again, as before si-swap
- addProcStep(newStep);
+ if (newStep) addProcStep(newStep);
} else if (newStep->getState() == SA_SMF_STEP_EXECUTING) {
// Fetch AU/DU and step swNode from IMM steps
SaAisErrorT rc = readCampaignImmModel(newStep);
@@ -3451,10 +3458,14 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
LOG_NO("Copy the procedure init actions");
addInitActions((*proc_iter).getInitActions());
for (const auto &actioniter : getInitActions()) {
+ if (!actioniter) {
+ TRACE("Procedure init action %d skip", initActionId);
+ continue;
+ }
// For the callback actions, set new calback procedure pointer
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actioniter);
- if (cbkAction != NULL) {
+ if (cbkAction) {
const_cast<SmfCallbackAction *>(cbkAction)->setCallbackProcedure(
this);
}
@@ -3469,11 +3480,15 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
LOG_NO("Copy the procedure wrapup actions");
addWrapupActions((*proc_iter).getWrapupActions());
for (const auto &actioniter : getWrapupActions()) {
+ if (!actioniter) {
+ TRACE("procedure wrapup action %d skip", wrapupActionId);
+ continue;
+ }
// For the callback actions, set new calback procedure
// For the callback actions, set new calback procedure pointer
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actioniter);
- if (cbkAction != NULL) {
+ if (cbkAction) {
const_cast<SmfCallbackAction *>(cbkAction)->setCallbackProcedure(
this);
}
@@ -3745,7 +3760,6 @@ SaAisErrorT SmfUpgradeProcedure::bundleRefFromSsCampaignImmModel(
SmfCampaignThread::instance()->campaign()->getUpgradeCampaign();
const std::vector<SmfUpgradeProcedure *> &procedures =
camp->getOriginalProcedures();
- std::vector<SmfUpgradeProcedure *>::const_iterator proc_iter;
std::list<SmfBundleRef> bundlesOldProcSS;
std::list<SmfBundleRef *> bundlesOldProcRO;
for (const auto &proc_elem : procedures) {
@@ -4132,9 +4146,9 @@ bool SmfUpgradeProcedure::isCompRestartable(const std::string &i_compDN) {
bool rc = true;
SaImmAttrValuesT_2 **attributes;
bool instanceCompDisableRestartIsSet = false;
- SaBoolT instanceCompDisableRestart;
+ SaBoolT instanceCompDisableRestart = SA_FALSE;
bool instanceCtDefDisableRestartIsSet = false;
- SaBoolT instanceCtDefDisableRestart;
+ SaBoolT instanceCtDefDisableRestart = SA_FALSE;
SmfImmUtils immUtil;
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-06-27 02:42:01
|
Summary: smf: fix coding issues identified by codechecker [#3369] Review request for Ticket(s): 3369 Peer Reviewer(s): Thang, Dat, Tai Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3369 Base revision: 6349a66032ea53f2b1757be2a80ed4e972f5733f Personal repository: git://git.code.sf.net/u/thienhuynh/review -------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision e831af5e523e6a961c2995dccb669ac51148bb52 Author: thien.m.huynh <thi...@en...> Date: Fri, 27 Jun 2025 09:11:30 +0700 smf: fix coding issues identified by codechecker [#3369] Complete diffstat: ------------------ src/smf/agent/smfa_utils.c | 8 +++---- src/smf/smfd/SmfCampState.cc | 4 ++-- src/smf/smfd/SmfCampaignWrapup.cc | 7 ++++-- src/smf/smfd/SmfImmOperation.h | 2 +- src/smf/smfd/SmfUpgradeCampaign.cc | 12 +++++----- src/smf/smfd/SmfUpgradeProcedure.cc | 48 ++++++++++++++++++++++++------------- 6 files changed, 49 insertions(+), 32 deletions(-) Testing Commands: ----------------- N/A Testing, Expected Results: -------------------------- N/A Conditions of Submission: ------------------------- ACK from reviewers Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y 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 ~/.gitconfig file (i.e. user.name, user.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. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-06-05 09:07:14
|
Hi Thang,
ACK with minor comments. Please check comment start with [Thien]
Best Regards,
Thien
________________________________
From: Thang Nguyen <tha...@en...>
Sent: Monday, May 26, 2025 11:44 AM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Tai Nguyen <tai...@en...>
Cc: ope...@li... <ope...@li...>; Thang Nguyen <tha...@en...>
Subject: [PATCH 1/1] osaf: Add a timeout to etcdctl to avoid hanging [#3375]
In etcd 3.4, it introduces automatic retries for failed RPCs.
It can cause hang on a dead/unreachable etcd server, especially
during txn, watch, or lock.
The solution is to add a timeout shell command in etcdctl command.
---
src/osaf/consensus/plugins/etcd3.plugin | 32 +++++++++++++------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/osaf/consensus/plugins/etcd3.plugin b/src/osaf/consensus/plugins/etcd3.plugin
index a5add53e7..9712fe3ed 100644
--- a/src/osaf/consensus/plugins/etcd3.plugin
+++ b/src/osaf/consensus/plugins/etcd3.plugin
@@ -24,8 +24,10 @@ readonly etcd_options=""
readonly etcd_timeout="3s"
readonly heartbeat_interval=2
readonly etcd_tolerance_timeout=6
+readonly command_timeout="3s"
export ETCDCTL_API=3
+ETCDCTL="timeout $command_timeout etcdctl $etcd_options --dial-timeout=${etcd_timeout}"
# get
# retrieve <value> of <key> from key-value store
@@ -38,7 +40,7 @@ export ETCDCTL_API=3
get() {
readonly key="$1"
- if output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout get "$directory$key" 2>&1)
+ if output=$($ETCDCTL get "$directory$key" 2>&1)
then
key_=$(echo "$output" | tail -n2 | head -n1)
value=$(echo "$output" | tail -n1)
@@ -76,7 +78,7 @@ setkey() {
if [ $timeout -gt 0 ]; then
# create lease
- if output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout lease grant $timeout)
+ if output=$($ETCDCTL lease grant $timeout)
then
lease_id=$(echo $output | awk '{print $2}')
lease_param="--lease="$lease_id""
@@ -87,7 +89,7 @@ setkey() {
lease_param=""
fi
- if etcdctl $etcd_options --dial-timeout $etcd_timeout put "$directory$key" \
+ if $ETCDCTL put "$directory$key" \
"$value" "$lease_param" >/dev/null
then
return 0
@@ -115,7 +117,7 @@ create_key() {
if [ $timeout -gt 0 ]; then
# create lease
- if output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout lease grant $timeout)
+ if output=$($ETCDCTL lease grant $timeout)
then
lease_id=$(echo $output | awk '{print $2}')
lease_param="--lease="$lease_id""
@@ -132,12 +134,12 @@ create_key() {
put \""$directory$key"\" \""$value"\" "$lease_param"
"
- output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout txn <<< "$transaction")
+ output=$($ETCDCTL txn <<< "$transaction")
if [[ "$output" == *"OK"* ]]; then
return 0
fi
- if output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout get "$directory$key" | tail -n1)
+ if output=$($ETCDCTL get "$directory$key" | tail -n1)
then
return 1
else
@@ -165,7 +167,7 @@ setkey_match_prev() {
if [ $timeout -gt 0 ]; then
# create lease
- if output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout lease grant $timeout)
+ if output=$($ETCDCTL lease grant $timeout)
then
lease_id=$(echo $output | awk '{print $2}')
lease_param="--lease="$lease_id""
@@ -182,7 +184,7 @@ setkey_match_prev() {
put \""$directory$key"\" \""$value"\" "$lease_param"
"
- output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout txn <<< "$transaction")
+ output=$($ETCDCTL txn <<< "$transaction")
if [[ "$output" == *"OK"* ]]; then
return 0
fi
@@ -200,7 +202,7 @@ setkey_match_prev() {
erase() {
readonly key="$1"
[Thien] carry into one line for better reading
if $ETCDCTL del "$directory$key" >/dev/null 2>&1
- if etcdctl $etcd_options --dial-timeout $etcd_timeout \
+ if $ETCDCTL \
del "$directory$key" >/dev/null 2>&1
then
return 0
@@ -228,7 +230,7 @@ lock() {
put \""$directory$keyname"\" \""$owner"\"
"
- output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout txn <<< "$transaction")
+ output=$($ETCDCTL txn <<< "$transaction")
if [[ "$output" == *"OK"* ]]; then
return 0
fi
@@ -239,12 +241,12 @@ lock() {
put \""$directory$keyname"\" \""$owner"\"
"
- output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout txn <<< "$transaction")
+ output=$($ETCDCTL txn <<< "$transaction")
if [[ "$output" == *"OK"* ]]; then
return 0
fi
- current_owner=$(etcdctl $etcd_options --dial-timeout $etcd_timeout get "$directory$keyname" | tail -n1)
+ current_owner=$($ETCDCTL get "$directory$keyname" | tail -n1)
# see if we already hold the lock
if [ "$current_owner" = "$owner" ]; then
return 0
@@ -295,7 +297,7 @@ unlock() {
put \""$directory$keyname"\" \"\"
"
- output=$(etcdctl $etcd_options --dial-timeout $etcd_timeout txn <<< "$transaction")
+ output=$($ETCDCTL txn <<< "$transaction")
if [[ "$output" == *"OK"* ]]; then
return 0
fi
@@ -315,7 +317,7 @@ unlock() {
return 2
fi
[Thien] carry into one line for better reading
if $ETCDCTL del "$directory$keyname" >/dev/null 2>&1
- if etcdctl $etcd_options --dial-timeout $etcd_timeout \
+ if $ETCDCTL \
del "$directory$keyname" >/dev/null 2>&1
then
return 0
@@ -354,7 +356,7 @@ watch() {
result=$?
if [ "$result" -gt 1 ]; then
# etcd down?, check the healthiness of self endpoint
- $(etcdctl endpoint health >/dev/null 2>&1)
+ $($ETCDCTL endpoint health >/dev/null 2>&1)
is_healthy=$?
((tol_timeout=tol_timeout+heartbeat_interval))
if [ $tol_timeout -ge $etcd_tolerance_timeout ] || [ $is_healthy -ne 0 ]; then
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-05-20 10:38:39
|
Summary: smf: fix coding issue identified by codechecker [#3369] Review request for Ticket(s): 3369 Peer Reviewer(s): Thang, Dat Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected branch(es): develop Development branch: ticket-3369 Base revision: 0aea074508136aee5895c3f29d0b22c488c2a86f Personal repository: git://git.code.sf.net/u/thienhuynh/review -------------------------------- Impacted area Impact y/n -------------------------------- Docs n Build system n RPM/packaging n Configuration files n Startup scripts n SAF services n OpenSAF services y Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): --------------------------------------------- *** EXPLAIN/COMMENT THE PATCH SERIES HERE *** revision b2fa5509487725b20033006e51c9424b8835eb38 Author: thien.m.huynh <thi...@en...> Date: Tue, 20 May 2025 15:46:18 +0700 smf: fix coding issue identified by codechecker [#3369] Complete diffstat: ------------------ src/smf/agent/smfa_utils.c | 8 ++++---- src/smf/smfd/SmfCampState.cc | 4 ++-- src/smf/smfd/SmfCampaignWrapup.cc | 4 ++-- src/smf/smfd/SmfImmOperation.h | 2 +- src/smf/smfd/SmfUpgradeCampaign.cc | 8 ++++---- src/smf/smfd/SmfUpgradeProcedure.cc | 22 ++++++++++++++-------- 6 files changed, 27 insertions(+), 21 deletions(-) Testing Commands: ----------------- N/A Testing, Expected Results: -------------------------- N/A Conditions of Submission: ------------------------- ACK from reviewers Arch Built Started Linux distro ------------------------------------------- mips n n mips64 n n x86 n n x86_64 y y 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 ~/.gitconfig file (i.e. user.name, user.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. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. |
|
From: Thien H. <thi...@en...> - 2025-05-20 09:05:10
|
---
src/smf/agent/smfa_utils.c | 8 ++++----
src/smf/smfd/SmfCampState.cc | 4 ++--
src/smf/smfd/SmfCampaignWrapup.cc | 4 ++--
src/smf/smfd/SmfImmOperation.h | 2 +-
src/smf/smfd/SmfUpgradeCampaign.cc | 8 ++++----
src/smf/smfd/SmfUpgradeProcedure.cc | 22 ++++++++++++++--------
6 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/src/smf/agent/smfa_utils.c b/src/smf/agent/smfa_utils.c
index d9c7cbe6c..550bedaaf 100644
--- a/src/smf/agent/smfa_utils.c
+++ b/src/smf/agent/smfa_utils.c
@@ -379,8 +379,8 @@ uint32_t smfa_cbk_ok_resp_process(SaSmfHandleT smfHandle,
hdl_prev->next_hdl =
hdl_list->next_hdl;
/* Head node deleted.*/
- if ((hdl_list->hdl ==
- hdl_prev->hdl)) {
+ if (hdl_list->hdl ==
+ hdl_prev->hdl) {
cbk_list->hdl_list =
hdl_prev->next_hdl;
/* No more resp
@@ -417,7 +417,7 @@ uint32_t smfa_cbk_ok_resp_process(SaSmfHandleT smfHandle,
rmv_inv:
cbk_prev->next_cbk = cbk_list->next_cbk;
/* Last inv node.*/
- if ((cbk_list->inv_id == cbk_prev->inv_id)) {
+ if (cbk_list->inv_id == cbk_prev->inv_id) {
cb->cbk_list = cbk_prev->next_cbk;
}
free(cbk_list);
@@ -479,7 +479,7 @@ uint32_t smfa_cbk_err_resp_process(SaInvocationT invocation, SaSmfHandleT hdl)
rmv_inv:
cbk_prev->next_cbk = cbk_list->next_cbk;
/* Last inv node.*/
- if ((cbk_list->inv_id == cbk_prev->inv_id)) {
+ if (cbk_list->inv_id == cbk_prev->inv_id) {
cb->cbk_list = cbk_prev->next_cbk;
}
free(cbk_list);
diff --git a/src/smf/smfd/SmfCampState.cc b/src/smf/smfd/SmfCampState.cc
index 8f62fb0bc..c897f1ea8 100644
--- a/src/smf/smfd/SmfCampState.cc
+++ b/src/smf/smfd/SmfCampState.cc
@@ -375,7 +375,7 @@ SmfCampResultT SmfCampStateInitial::executeInit(SmfUpgradeCampaign *i_camp) {
TRACE_ENTER();
TRACE("SmfCampStateExecuting::executeInit, Running campaign init actions");
- if (i_camp->m_campInit.execute() != SA_AIS_OK) {
+ if (i_camp->m_campInit.execute() != true) {
std::string error = "Campaign init failed";
LOG_ER("%s", error.c_str());
SmfCampaignThread::instance()->campaign()->setError(error);
@@ -1847,7 +1847,7 @@ SmfCampResultT SmfCampRollingBack::rollbackInit(SmfUpgradeCampaign *i_camp) {
// succeeds. Write the same value, just for synchronization purposes.
changeState(i_camp, SmfCampRollingBack::instance());
- if (i_camp->m_campInit.rollback() != SA_AIS_OK) {
+ if (i_camp->m_campInit.rollback() != true) {
std::string error = "Campaign init rollback failed";
LOG_ER("%s", error.c_str());
SmfCampaignThread::instance()->campaign()->setError(error);
diff --git a/src/smf/smfd/SmfCampaignWrapup.cc b/src/smf/smfd/SmfCampaignWrapup.cc
index 8f5646424..018afe7a6 100644
--- a/src/smf/smfd/SmfCampaignWrapup.cc
+++ b/src/smf/smfd/SmfCampaignWrapup.cc
@@ -182,8 +182,8 @@ bool SmfCampaignWrapup::rollbackCampWrapup() {
LOG_NO("CAMP: Campaign wrapup, rollback wrapup actions (%zu)",
m_campWrapupAction.size());
for (auto& elem : m_campWrapupAction) {
- SmfImmCcbAction* immCcb = NULL;
- if ((immCcb = dynamic_cast<SmfImmCcbAction*>(elem)) != NULL) {
+ if (elem == NULL) continue;
+ if (dynamic_cast<SmfImmCcbAction*>(elem) != NULL) {
/* Since noone of these IMM CCB has been executed it's no point
in trying to roll them back */
TRACE("SmfCampaignWrapup skipping immCcb rollback %d", (*elem).getId());
diff --git a/src/smf/smfd/SmfImmOperation.h b/src/smf/smfd/SmfImmOperation.h
index ae537b820..a7cf80129 100644
--- a/src/smf/smfd/SmfImmOperation.h
+++ b/src/smf/smfd/SmfImmOperation.h
@@ -135,7 +135,7 @@ class SmfImmOperation {
// get the correct operation descriptor
enum OperationType { NotSet, Create, Delete, Modify };
- const OperationType GetOperationType() { return imm_operation_; }
+ OperationType GetOperationType() const { return imm_operation_; }
const modelmodify::CreateDescriptor GetCreateDescriptor() {
return object_create_;
}
diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc b/src/smf/smfd/SmfUpgradeCampaign.cc
index 4a1591abb..bf8224384 100644
--- a/src/smf/smfd/SmfUpgradeCampaign.cc
+++ b/src/smf/smfd/SmfUpgradeCampaign.cc
@@ -447,7 +447,7 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) {
TRACE_ENTER();
SaAisErrorT rc = SA_AIS_OK;
SaImmAttrValuesT_2 **attributes;
- int curCnt = 0;
+ SaUint32T curCnt = 0;
/* Read the SmfCampRestartInfo object smfCampRestartCnt attr */
std::string obj = "smfRestartInfo=info," +
@@ -484,8 +484,8 @@ SaAisErrorT SmfUpgradeCampaign::tooManyRestarts(bool *o_result) {
}
}
- int maxCnt = smfd_cb->smfCampMaxRestart;
- TRACE("maxCnt=%d, curCnt=%d", maxCnt, curCnt);
+ SaUint32T maxCnt = smfd_cb->smfCampMaxRestart;
+ TRACE("maxCnt=%u, curCnt=%u", maxCnt, curCnt);
if (curCnt > maxCnt) {
TRACE("TRUE");
*o_result = true;
@@ -1035,7 +1035,7 @@ void SmfUpgradeCampaign::resetMaintenanceState() {
uint32_t retry_cnt = 0;
while (++retry_cnt <= MAX_NO_RETRIES) {
rc = immUtil.doImmOperations(operations);
- if (rc != SA_AIS_OK && rc == SA_AIS_ERR_TRY_AGAIN) {
+ if (rc == SA_AIS_ERR_TRY_AGAIN) {
/*
* TRY_AGAIN is returned only when ccb is aborted
* with Resource abort in error string.
diff --git a/src/smf/smfd/SmfUpgradeProcedure.cc b/src/smf/smfd/SmfUpgradeProcedure.cc
index fae0af596..369dfa365 100644
--- a/src/smf/smfd/SmfUpgradeProcedure.cc
+++ b/src/smf/smfd/SmfUpgradeProcedure.cc
@@ -1250,6 +1250,7 @@ bool SmfUpgradeProcedure::mergeStepIntoSingleStep(SmfUpgradeProcedure *i_proc,
LOG_NO(
"SmfUpgradeProcedure::mergeStepIntoSingleStep: Procedure scope not found (forAddRemove/forModify)");
delete newStep;
+ newStep = nullptr;
TRACE_LEAVE();
return false;
}
@@ -1268,6 +1269,7 @@ bool SmfUpgradeProcedure::mergeStepIntoSingleStep(SmfUpgradeProcedure *i_proc,
LOG_NO("Copy the procedure init actions");
i_proc->addInitActions((*proc_elem).getInitActions());
for (const auto &actionElem : i_proc->getInitActions()) {
+ if (actionElem == NULL) continue;
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actionElem);
if (cbkAction != NULL) {
@@ -1282,6 +1284,7 @@ bool SmfUpgradeProcedure::mergeStepIntoSingleStep(SmfUpgradeProcedure *i_proc,
LOG_NO("Copy the procedure wrapup actions");
i_proc->addWrapupActions((*proc_elem).getWrapupActions());
for (const auto &actionElem : i_proc->getWrapupActions()) {
+ if (actionElem == NULL) continue;
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actionElem);
if (cbkAction != NULL) {
@@ -2674,21 +2677,21 @@ SaAisErrorT SmfUpgradeProcedure::createImmStep(SmfUpgradeStep *i_step) {
SmfImmAttribute attrsaSmfStepMaxRetry;
attrsaSmfStepMaxRetry.SetAttributeName("saSmfStepMaxRetry");
attrsaSmfStepMaxRetry.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getMaxRetry());
+ snprintf(str, strSize, "%u", i_step->getMaxRetry());
attrsaSmfStepMaxRetry.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepMaxRetry);
SmfImmAttribute attrsaSmfStepRetryCount;
attrsaSmfStepRetryCount.SetAttributeName("saSmfStepRetryCount");
attrsaSmfStepRetryCount.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getRetryCount());
+ snprintf(str, strSize, "%u", i_step->getRetryCount());
attrsaSmfStepRetryCount.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepRetryCount);
SmfImmAttribute attrsaSmfStepRestartOption;
attrsaSmfStepRestartOption.SetAttributeName("saSmfStepRestartOption");
attrsaSmfStepRestartOption.SetAttributeType("SA_IMM_ATTR_SAUINT32T");
- snprintf(str, strSize, "%d", i_step->getRestartOption());
+ snprintf(str, strSize, "%u", i_step->getRestartOption());
attrsaSmfStepRestartOption.AddAttributeValue(str);
icoSaSmfStep.AddValue(attrsaSmfStepRestartOption);
@@ -3359,6 +3362,7 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
LOG_NO(
"SmfUpgradeProcedure::getImmStepsMergedSingleStep: Failed to get steps for procedure %s",
getDn().c_str());
+ delete newStep;
TRACE_LEAVE();
return SA_AIS_ERR_NOT_EXIST;
}
@@ -3371,6 +3375,7 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
LOG_NO(
"SmfUpgradeProcedure::getImmStepsMergedSingleStep: IMM data for step %s not found",
(*stepit).c_str());
+ delete newStep;
TRACE_LEAVE();
return SA_AIS_ERR_NOT_EXIST;
}
@@ -3409,7 +3414,7 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
if (newStep->getState() == SA_SMF_STEP_INITIAL) {
mergeStepIntoSingleStep(this,
newStep); // Just merge again, as before si-swap
- addProcStep(newStep);
+ if (newStep != nullptr) addProcStep(newStep);
} else if (newStep->getState() == SA_SMF_STEP_EXECUTING) {
// Fetch AU/DU and step swNode from IMM steps
SaAisErrorT rc = readCampaignImmModel(newStep);
@@ -3451,13 +3456,14 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
LOG_NO("Copy the procedure init actions");
addInitActions((*proc_iter).getInitActions());
for (const auto &actioniter : getInitActions()) {
+ if (actioniter == NULL) continue;
// For the callback actions, set new calback procedure pointer
const SmfCallbackAction *cbkAction =
dynamic_cast<const SmfCallbackAction *>(actioniter);
if (cbkAction != NULL) {
const_cast<SmfCallbackAction *>(cbkAction)->setCallbackProcedure(
this);
- }
+ }
// Renumber action id aviod DN name collision in the merged procedure
// rollback data
@@ -3469,6 +3475,7 @@ SaAisErrorT SmfUpgradeProcedure::getImmStepsMergedSingleStep() {
LOG_NO("Copy the procedure wrapup actions");
addWrapupActions((*proc_iter).getWrapupActions());
for (const auto &actioniter : getWrapupActions()) {
+ if (actioniter == NULL) continue;
// For the callback actions, set new calback procedure
// For the callback actions, set new calback procedure pointer
const SmfCallbackAction *cbkAction =
@@ -3745,7 +3752,6 @@ SaAisErrorT SmfUpgradeProcedure::bundleRefFromSsCampaignImmModel(
SmfCampaignThread::instance()->campaign()->getUpgradeCampaign();
const std::vector<SmfUpgradeProcedure *> &procedures =
camp->getOriginalProcedures();
- std::vector<SmfUpgradeProcedure *>::const_iterator proc_iter;
std::list<SmfBundleRef> bundlesOldProcSS;
std::list<SmfBundleRef *> bundlesOldProcRO;
for (const auto &proc_elem : procedures) {
@@ -4132,9 +4138,9 @@ bool SmfUpgradeProcedure::isCompRestartable(const std::string &i_compDN) {
bool rc = true;
SaImmAttrValuesT_2 **attributes;
bool instanceCompDisableRestartIsSet = false;
- SaBoolT instanceCompDisableRestart;
+ SaBoolT instanceCompDisableRestart = SA_FALSE;
bool instanceCtDefDisableRestartIsSet = false;
- SaBoolT instanceCtDefDisableRestart;
+ SaBoolT instanceCtDefDisableRestart = SA_FALSE;
SmfImmUtils immUtil;
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-05-08 04:13:08
|
Hi Thang,
ACK without comment.
Best Regards,
Thien
________________________________
From: Thang Nguyen <tha...@en...>
Sent: Monday, April 28, 2025 5:40 PM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Tai Nguyen <tai...@en...>
Cc: ope...@li... <ope...@li...>; Thang Nguyen <tha...@en...>
Subject: [PATCH 1/1] smfd: Correct exec level of balanced procedure [#3370]
When the upgrade is configured as balanced in service upgrade (BISU),
the exec level of balanced proc is set to one higher than the highest
of the original proc used in balanced groups. The exec level
of balanced procedures should not be set by another balanced procs.
---
src/smf/smfd/SmfExecControl.cc | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/smf/smfd/SmfExecControl.cc b/src/smf/smfd/SmfExecControl.cc
index 27584385f..5eeeb7cd9 100644
--- a/src/smf/smfd/SmfExecControl.cc
+++ b/src/smf/smfd/SmfExecControl.cc
@@ -140,6 +140,7 @@ bool setBalancedExecLevel(const std::vector<std::string>& nodesforss,
for (auto node : nodes) {
if (isNodeInGroup(node, nodesforss)) {
ingroup = true;
+ break;
}
}
if (ingroup) {
@@ -156,19 +157,17 @@ bool setBalancedExecLevel(const std::vector<std::string>& nodesforss,
}
balanced_execlvl += 1;
- // Move the exec-level forward for other procedures so we avoid to execute in
- // parallel with balanced procedures
- for (auto proc : ucamp->getProcedures()) {
- if (proc->getExecLevel() >= balanced_execlvl) {
- proc->setExecLevel(std::to_string(proc->getExecLevel() + numberofss));
- }
- }
-
for (auto proc : ucamp->getProcedures()) {
if (!proc->getBalancedGroup().empty()) {
// This is a balanced procedure, set the new exec level
proc->setExecLevel(
std::to_string(proc->getExecLevel() + balanced_execlvl));
+ } else {
+ // Move the exec-level forward for other procedures so
+ // we avoid to execute in parallel with balanced procedures
+ if (proc->getExecLevel() >= balanced_execlvl) {
+ proc->setExecLevel(std::to_string(proc->getExecLevel() + numberofss));
+ }
}
}
if (!merged.empty()) {
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-05-05 12:48:29
|
Hi Tai,
ACK with minor comment on commit message.
Short commit message should be start with verb like fix, correct, add,... That describes what the changes in the commit.
E.g. Fix immxml-merge failure caused by encoding mismatch
Best Regards,
Thien
________________________________
From: Tai Nguyen <tai...@en...>
Sent: Monday, May 5, 2025 4:48 PM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Thang Nguyen <tha...@en...>
Cc: ope...@li... <ope...@li...>; Tai Nguyen <tai...@en...>
Subject: [PATCH 1/1] imm: Failure when merging XML files with different encodings [#3371]
The immxml-merge tool uses the encoding of the first input file to set the
output file's encoding. If any subsequent input files require UTF-8 encoding
but the first file is not encoded in UTF-8, then immxml-merge will fail.
UTF-8 encoding will be applied to the output files if any input file
uses UTF-8 encoding.
---
src/imm/tools/immxml-merge | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/imm/tools/immxml-merge b/src/imm/tools/immxml-merge
index 9a03d3a9b..6f1ae21d5 100755
--- a/src/imm/tools/immxml-merge
+++ b/src/imm/tools/immxml-merge
@@ -78,7 +78,7 @@ class MergedImmDocument(BaseImmDocument):
self.classDict = {}
self.regexpObj = None
self.dn_regexpObj = None
- self.firstSourceDoc = None
+ self.encoding = None
self.objectList = []
self.objectDnNameDict = {}
self.classes_parsed = 0
@@ -115,7 +115,6 @@ class MergedImmDocument(BaseImmDocument):
abort_script("Did not find <imm:IMM-contents element in first "
"source file")
- self.firstSourceDoc = doc
self.isResultDocInitialized = True
trace("Done copying elements from first source document.")
@@ -298,6 +297,9 @@ class MergedImmDocument(BaseImmDocument):
doc = xml.dom.minidom.parse(file_name)
# doc = self.open_xml_document_file_and_check_namespace(file_name)
+ if doc.encoding is not None and self.encoding is None:
+ if doc.encoding.lower() == "utf-8":
+ self.encoding = "utf-8"
if not self.isResultDocInitialized:
self.init_result_document(doc)
@@ -362,17 +364,12 @@ class MergedImmDocument(BaseImmDocument):
# I think there should not be imm validation functionality in merge
# tool (use validate_immfile instead)
- print_info_stderr("encoding in first source xml document: %s",
- self.firstSourceDoc.encoding)
tmp_output_file_name = Options.outputFilename + ".tmp"
file_object = open(tmp_output_file_name, "w")
-
- if self.firstSourceDoc.encoding is not None \
- and self.firstSourceDoc.encoding.lower() == "utf-8":
- encoding = "utf-8"
+ encoding = "utf-8"
+ if self.encoding == "utf-8":
heading = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
else:
- encoding = None
heading = "<?xml version=\"1.0\"?>"
file_object.write(heading)
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|
|
From: Thien H. <thi...@en...> - 2025-03-27 06:14:00
|
Hi Khuong,
ACK from me.
Best Regards,
Thien
________________________________
From: Khuong Le <khu...@en...>
Sent: Thursday, March 27, 2025 12:05 PM
To: Thien Huynh <thi...@en...>; Dat Phan <dat...@en...>; Thang Nguyen <tha...@en...>
Cc: ope...@li... <ope...@li...>; Khuong Le <khu...@en...>
Subject: [PATCH 1/1] ntf: Add new configured variable for logger records timeout [#3363]
Currently, the NTFS_LOGGER_RECORD_TIMEOUT default is set to 10s
and cannot be changed. In some cases, notifications may become overdue
and can be removed.
We offer a way for this variable to be configured as an environment variable
that can be exported from a configuration file, enabling flexible setting.
We define limit for notification overdue timeout to range from 5s to 30s,
with default still being 10s.
---
src/ntf/README | 8 ++++++++
src/ntf/ntfd/NtfLogger.cc | 17 ++++++++++++++++-
src/ntf/ntfd/NtfLogger.h | 1 +
src/ntf/ntfd/NtfNotification.cc | 5 ++---
src/ntf/ntfd/NtfNotification.h | 2 +-
src/ntf/ntfd/ntfd.conf | 6 ++++++
src/ntf/ntfd/ntfs.h | 4 +++-
7 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/src/ntf/README b/src/ntf/README
index 5bf670647..155d00ba1 100644
--- a/src/ntf/README
+++ b/src/ntf/README
@@ -244,6 +244,14 @@ writing notification is fail for long time, NTF has to write a big number of
notifications whenever handling sending notification request and that will delay
to handle other requests come to NTFD. The value of variable is from 10 to 5000.
+NTFSV_LOGGER_RECORD_TIMEOUT
+
+The logger record timeout is used to remove the overdue notification.
+When the file system is unresponsive and the logger buffer stays full for a
+long period of time, overload occurs. This variable is designed to fix the side
+effect of this problem like: ntf reject incoming request due to overloaded.
+The variable's value ranges from 5 to 30 seconds (by default, it is 10).
+
for debug see DEBUG.
COMMAND LINE INTERFACE
diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
index 480c9e7b6..f6cc6de95 100644
--- a/src/ntf/ntfd/NtfLogger.cc
+++ b/src/ntf/ntfd/NtfLogger.cc
@@ -92,6 +92,20 @@ NtfLogger::NtfLogger() : readCounter(0), isLoggerBufferfull(false) {
LOG_WA("Logger buffer is set too big, get default max instead: %d",
logger_buffer_capacity);
}
+
+ /* Get the logger record timeout from the environment variable.
+ The value should be from 5s to 30s (Default is 10s). */
+ logger_timeout_record = base::GetEnv("NTFSV_LOGGER_RECORD_TIMEOUT",
+ static_cast<uint32_t>(NTFSV_LOGGER_RECORD_TIMEOUT_DEFAULT));
+ if (logger_timeout_record < NTFSV_LOGGER_RECORD_TIMEOUT_MIN) {
+ logger_timeout_record = NTFSV_LOGGER_RECORD_TIMEOUT_MIN;
+ LOG_WA("Logger timeout is set too small, get default min instead: %d",
+ NTFSV_LOGGER_RECORD_TIMEOUT_MIN);
+ } else if (logger_timeout_record > NTFSV_LOGGER_RECORD_TIMEOUT_MAX) {
+ logger_timeout_record = NTFSV_LOGGER_RECORD_TIMEOUT_MAX;
+ LOG_WA("Logger timeout is set too big, get default max instead: %d",
+ NTFSV_LOGGER_RECORD_TIMEOUT_MAX);
+ }
}
/* Callbacks */
@@ -392,7 +406,8 @@ bool NtfLogger::isExistNotification(SaInvocationT invocation) {
void NtfLogger::logQueuedNotification() {
if (!isLoggerBufferEmpty()) {
NtfSmartPtr notification = queuedNotificationList.front();
- if (notification->is_overdue() && notification->isWaitingAck()) {
+ if (notification->is_overdue(logger_timeout_record)
+ && notification->isWaitingAck()) {
LOG_NO("Notification overdue, remove notification Id: %llu",
notification->getNotificationId());
dequeueNotification();
diff --git a/src/ntf/ntfd/NtfLogger.h b/src/ntf/ntfd/NtfLogger.h
index 4af8fc3d8..4a3f81df7 100644
--- a/src/ntf/ntfd/NtfLogger.h
+++ b/src/ntf/ntfd/NtfLogger.h
@@ -83,6 +83,7 @@ class NtfLogger {
typedef std::list<NtfSmartPtr> QueuedNotificationsList;
QueuedNotificationsList queuedNotificationList;
+ uint32_t logger_timeout_record;
uint32_t logger_buffer_capacity;
// The flag if logger buffer is full. This is set when checking the logger
diff --git a/src/ntf/ntfd/NtfNotification.cc b/src/ntf/ntfd/NtfNotification.cc
index 957206dfb..213ad1b97 100644
--- a/src/ntf/ntfd/NtfNotification.cc
+++ b/src/ntf/ntfd/NtfNotification.cc
@@ -267,11 +267,10 @@ void NtfNotification::removeSubscription(unsigned int clientId,
*/
ntfsv_send_not_req_t* NtfNotification::getNotInfo() { return sendNotInfo_; }
-bool NtfNotification::is_overdue() const {
- uint32_t max_time = NTFSV_LOGGER_RECORD_TIMEOUT_S;
+bool NtfNotification::is_overdue(uint32_t timeout) const {
timespec queue_at = base::NanosToTimespec(queue_at_);
timespec current = base::ReadMonotonicClock();
- timespec max_queue_time{static_cast<time_t>(max_time), 0};
+ timespec max_queue_time{static_cast<time_t>(timeout), 0};
return (current - queue_at > max_queue_time);
}
diff --git a/src/ntf/ntfd/NtfNotification.h b/src/ntf/ntfd/NtfNotification.h
index d025648cf..ec12975b9 100644
--- a/src/ntf/ntfd/NtfNotification.h
+++ b/src/ntf/ntfd/NtfNotification.h
@@ -68,7 +68,7 @@ class NtfNotification {
SaNtfNotificationHeaderT* header();
ntfsv_send_not_req_t* sendNotInfo_;
bool loggFromCallback_;
- bool is_overdue() const;
+ bool is_overdue(uint32_t timeout) const;
private:
NtfNotification();
diff --git a/src/ntf/ntfd/ntfd.conf b/src/ntf/ntfd/ntfd.conf
index f2f67496f..8df0fbf13 100644
--- a/src/ntf/ntfd/ntfd.conf
+++ b/src/ntf/ntfd/ntfd.conf
@@ -51,3 +51,9 @@ export NTFSV_ENV_HEALTHCHECK_KEY="Default"
# notifications whenever handling sending notification request and that will delay
# to handle other requests come to NTFD. The value of variable is from 10 to 5000.
#export NTFSV_LOGGER_BUFFER_CAPACITY=10
+
+# The logger record timeout is used to remove the overdue notification.
+# The default timeout is 10s, uncomment the next line to configure the logger recored timeout.
+# The range can be configure from 5s to 30s.
+# export NTFSV_LOGGER_RECORD_TIMEOUT=10
+
diff --git a/src/ntf/ntfd/ntfs.h b/src/ntf/ntfd/ntfs.h
index ee0276211..56d30dba0 100644
--- a/src/ntf/ntfd/ntfs.h
+++ b/src/ntf/ntfd/ntfs.h
@@ -58,7 +58,9 @@
// Periodic timer. Using in the main poll when queue available
#define NTFSV_LOGGER_PERODIC_POLL_TIMEOUT_MS 5000
// Allowed queue time before notification overdue
-#define NTFSV_LOGGER_RECORD_TIMEOUT_S 10
+#define NTFSV_LOGGER_RECORD_TIMEOUT_DEFAULT 10
+#define NTFSV_LOGGER_RECORD_TIMEOUT_MIN 5
+#define NTFSV_LOGGER_RECORD_TIMEOUT_MAX 30
/* ========================================================================
* TYPE DEFINITIONS
--
2.25.1
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
|