Ack

/Lennart

> -----Original Message-----
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: den 8 augusti 2017 11:31
> To: mahesh.va...@oracle.com; Lennart Lund <lennart.l...@ericsson.com>;
> Canh Van Truong <canh.v.tru...@dektech.com.au>
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> <vu.m.ngu...@dektech.com.au>
> Subject: [PATCH 1/1] log: fix referring to uninitialized variable caused
> assertion failed [#2546]
> 
> Log application got coredump due to failed assertion in Log agent.
> The problem was caused by referring to uninitialized variable `bool updated`.
> 
> Previously, `updated` variable was initialized when the method
> `FetchAndIncreaseRefCounter` or `FetchAndDecreaseRefCounter` was
> called.
> 
> The value of `updated` is true, means the reference counter has been
> updated,
> false otherwise. So, if `updated` variable was unluckily assigned `true`
> in default, reference counter could be restored unexpectedly.
> ---
>  src/log/agent/lga_agent.cc | 12 ++++++------
>  src/log/agent/lga_mds.cc   |  2 +-
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
> index fe94b58..c6ca331 100644
> --- a/src/log/agent/lga_agent.cc
> +++ b/src/log/agent/lga_agent.cc
> @@ -411,7 +411,7 @@ SaAisErrorT LogAgent::saLogSelectionObjectGet(
>      SaLogHandleT logHandle, SaSelectionObjectT* selectionObject) {
>    SaAisErrorT ais_rc = SA_AIS_OK;
>    LogClient* client = nullptr;
> -  bool updated;
> +  bool updated = false;
> 
>    TRACE_ENTER();
> 
> @@ -461,7 +461,7 @@ SaAisErrorT LogAgent::saLogSelectionObjectGet(
>  SaAisErrorT LogAgent::saLogDispatch(SaLogHandleT logHandle,
>                                      SaDispatchFlagsT dispatchFlags) {
>    LogClient* client = nullptr;
> -  bool updated;
> +  bool updated = false;
>    SaAisErrorT ais_rc;
> 
>    TRACE_ENTER();
> @@ -554,7 +554,7 @@ SaAisErrorT LogAgent::SendFinalizeMsg(uint32_t
> client_id) {
> 
>  SaAisErrorT LogAgent::saLogFinalize(SaLogHandleT logHandle) {
>    LogClient* client = nullptr;
> -  bool updated;
> +  bool updated = false;
>    bool is_locked = false;
>    SaAisErrorT ais_rc = SA_AIS_OK;
> 
> @@ -804,7 +804,7 @@ SaAisErrorT LogAgent::saLogStreamOpen_2(
>    SaLogHeaderTypeT log_header_type = SA_LOG_NTF_HEADER;
>    bool is_locked = false;
>    SaConstStringT streamName;
> -  bool updated;
> +  bool updated = false;
> 
>    TRACE_ENTER();
> 
> @@ -1114,7 +1114,7 @@ SaAisErrorT
> LogAgent::saLogWriteLogAsync(SaLogStreamHandleT logStreamHandle,
>    char logSvcUsrName[kOsafMaxDnLength] = {0};
>    bool is_locked = false;
>    SaNameT tmpSvcUsrName;
> -  bool cUpdated, sUpdated;
> +  bool cUpdated = false, sUpdated = false;
> 
>    TRACE_ENTER();
> 
> @@ -1284,7 +1284,7 @@ SaAisErrorT
> LogAgent::saLogStreamClose(SaLogStreamHandleT logStreamHandle) {
>    SaAisErrorT ais_rc = SA_AIS_OK;
>    uint32_t mds_rc;
>    bool is_locked = false;
> -  bool sUpdated, cUpdated;
> +  bool sUpdated = false, cUpdated = false;
> 
>    TRACE_ENTER();
> 
> diff --git a/src/log/agent/lga_mds.cc b/src/log/agent/lga_mds.cc
> index 78bd7e1..e40adae 100644
> --- a/src/log/agent/lga_mds.cc
> +++ b/src/log/agent/lga_mds.cc
> @@ -521,7 +521,7 @@ static uint32_t lga_lgs_msg_proc(lgsv_msg_t
> *lgsv_msg,
>    }
> 
>    // @client is being deleted in other thread. DO NOT touch this.
> -  bool updated;
> +  bool updated = false;
>    if (client->FetchAndIncreaseRefCounter(&updated) == -1) {
>      LogAgent::instance().LeaveCriticalSection();
>      lga_msg_destroy(lgsv_msg);
> --
> 1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to