Ok, please re-test  and publish.

-AVM


On 11/16/2016 2:43 PM, Vo Minh Hoang wrote:
> Dear Mahesh,
>
> Thank you very much.
>
> Might it be like this acceptable, If yes I will send V2 patch.
>
>       if (ckpt_node->node_users_cnt) {
>               int count = 0;
>               CPD_NODE_USER_INFO *node_user = ckpt_node->node_users;
>               cpd_msg.info.usr_info_2.node_list =
> malloc(ckpt_node->node_users_cnt * sizeof(CPD_NODE_USER_INFO));
>               memset(cpd_msg.info.usr_info_2.node_list, '\0',
> (sizeof(CPD_NODE_USER_INFO) * ckpt_node->node_users_cnt));
>
>               for (; node_user != NULL && count <
> ckpt_node->node_users_cnt; node_user = node_user->next) {
>                       cpd_msg.info.usr_info_2.node_list[count].dest =
> node_user->dest;
>                       cpd_msg.info.usr_info_2.node_list[count].num_users =
> node_user->num_users;
>                       cpd_msg.info.usr_info_2.node_list[count].num_readers
> = node_user->num_readers;
>                       cpd_msg.info.usr_info_2.node_list[count].num_writers
> = node_user->num_writers;
>                       ++count;
>               }
>
>               /* Update node_users_cnt in case of mismatch */
>               ckpt_node->node_users_cnt = count;
>               cpd_msg.info.usr_info_2.node_users_cnt = count;
>       }
>
>
> Sincerely,
> Hoang
>
> -----Original Message-----
> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
> Sent: Wednesday, November 16, 2016 3:29 PM
> To: Vo Minh Hoang <hoang.m...@dektech.com.au>; anders.wid...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] fix crash problem by checking null pointer
> before accessing its detail
>
> Hi,
>
> Still we can right the code, I just checked the code,  follow the way
> `node_user = node_user->next` is used in other occurrence part of the code.
>
> -AVM
>
> On 11/16/2016 12:16 PM, Vo Minh Hoang wrote:
>> Dear Mahesh,
>>
>> Thank you very much for your comments.
>>
>> Because the coredump occur when ckpt_node->node_users_cnt is not
>> updated correctly to the number of node_user so we count here to
>> handle that mismatch.
>> Might it possible to keep using like currently?
>>
>> Sincerely,
>> Hoang
>>
>> -----Original Message-----
>> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
>> Sent: Wednesday, November 16, 2016 11:00 AM
>> To: Vo Minh Hoang <hoang.m...@dektech.com.au>;
>> anders.wid...@ericsson.com
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] fix crash problem by checking null pointer
>> before accessing its detail
>>
>>
>> Hi Hoang Vo,
>>
>>>> Please let me know if you have any further inquiry.
>> Can you please also make the fix more readable replace  `for (count =
>> 0; count < ckpt_node->node_users_cnt; count++) {` some thing like `for
>> (node_user = ckpt_node->node_users; node_user != NULL; node_user =
>> node_user->next) {`
>> then, we can remove    variable `int count = 0;`,   move
>> `cpd_msg.info.usr_info_2.node_users_cnt = ckpt_node->node_users_cnt;`
>> after for () loop.
>>
>> -AVM
>>
>>
>> On 11/16/2016 9:14 AM, Vo Minh Hoang wrote:
>>> Dear Mahesh,
>>>
>>> I am sorry that I cannot share the test steps because I cannot
>>> reproduce it in local environment.
>>> I've just received the coredump information point directly to this
>>> part, reviewed source code and found that pointer using is unsafe so
>>> I
>> correct it.
>>> Please let me know if you have any further inquiry.
>>>
>>> Thank you and best regard,
>>> Hoang
>>>
>>> -----Original Message-----
>>> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
>>> Sent: Wednesday, November 16, 2016 10:22 AM
>>> To: Hoang Vo <hoang.m...@dektech.com.au>; anders.wid...@ericsson.com
>>> Cc: opensaf-devel@lists.sourceforge.net
>>> Subject: Re: [PATCH 1 of 1] fix crash problem by checking null
>>> pointer before accessing its detail
>>>
>>> Hi Hoang Vo,
>>>
>>> On 11/15/2016 12:57 PM, Hoang Vo wrote:
>>>> Testing Commands:
>>>> -----------------
>>>>
>>>>
>>>> Testing, Expected Results:
>>>> --------------------------
>>>>
>>> Can you please share test case .
>>>
>>> -AVM
>>>
>>> On 11/15/2016 12:57 PM, Hoang Vo wrote:
>>>>      osaf/services/saf/cpsv/cpd/cpd_red.c |  5 +++++
>>>>      1 files changed, 5 insertions(+), 0 deletions(-)
>>>>
>>>>
>>>> diff --git a/osaf/services/saf/cpsv/cpd/cpd_red.c
>>> b/osaf/services/saf/cpsv/cpd/cpd_red.c
>>>> --- a/osaf/services/saf/cpsv/cpd/cpd_red.c
>>>> +++ b/osaf/services/saf/cpsv/cpd/cpd_red.c
>>>> @@ -322,6 +322,11 @@ void cpd_a2s_ckpt_usr_info(CPD_CB *cb, C
>>>>                    memset(cpd_msg.info.usr_info_2.node_list, '\0',
>>> (sizeof(CPD_NODE_USER_INFO) * ckpt_node->node_users_cnt));
>>>>      
>>>>                    for (count = 0; count < ckpt_node->node_users_cnt;
> count++)
>>> {
>>>> +                  if (node_user == NULL) {
>>>> +                          ckpt_node->node_users_cnt = count;
>>>> +                          cpd_msg.info.usr_info_2.node_users_cnt =
>>> count;
>>>> +                          break;
>>>> +                  }
>>>>
> cpd_msg.info.usr_info_2.node_list[count].dest =
>>> node_user->dest;
> cpd_msg.info.usr_info_2.node_list[count].num_users =
>>> node_user->num_users;
> cpd_msg.info.usr_info_2.node_list[count].num_readers
>>> = node_user->num_readers;
>>>
>>>
>


------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to