good for merge
regards
-steve
On Thu, 2010-04-22 at 18:14 +0200, Jan Friesse wrote:
> Attached patch handles some (mostly minor) problems shown by valgrind.
>
> - First is memset in res_setup (coroipcs). This is done only once per
> connection, so slowdown is minimal
> - Two memset in logsys. This is done only once per corosync run
> - Problem in corosync_totem_stats_updater where avg_token_holdtime has
> sizeof avg_backlog_calc (sizes are same so it really doesn't matter)
> - corosync_totem_stats_init - avg_backlog_calc is 32 bits
> - objdb problem if new_valie_len != object->value_len. In such case
> newly allocated memory is not initialized and in some situations,
> value_len is not updated.
>
> Regards,
> Honza
> plain text document attachment (2010-04-22-valgrind-errors.patch)
> diff --git a/trunk/exec/coroipcs.c b/trunk/exec/coroipcs.c
> index a64343d..9394f21 100644
> --- a/trunk/exec/coroipcs.c
> +++ b/trunk/exec/coroipcs.c
> @@ -727,6 +727,7 @@ req_setup_send (
> mar_res_setup_t res_setup;
> unsigned int res;
>
> + memset (&res_setup, 0, sizeof (res_setup));
> res_setup.error = error;
>
> retry_send:
> diff --git a/trunk/exec/logsys.c b/trunk/exec/logsys.c
> index c214350..f649e5f 100644
> --- a/trunk/exec/logsys.c
> +++ b/trunk/exec/logsys.c
> @@ -731,6 +731,8 @@ static void *logsys_worker_thread (void *data)
> int log_msg;
> char buf[COMBINE_BUFFER_SIZE];
>
> + memset (buf, 0, sizeof (buf));
> +
> /*
> * Signal wthread_create that the initialization process may continue
> */
> @@ -1111,6 +1113,7 @@ int _logsys_rec_init (unsigned int fltsize)
> return (-1);
> }
>
> + memset (flt_data, 0, flt_real_size);
> /*
> * flt_data_size tracks data by ints and not bytes/chars.
> *
> diff --git a/trunk/exec/main.c b/trunk/exec/main.c
> index 0b7982a..c8fda30 100644
> --- a/trunk/exec/main.c
> +++ b/trunk/exec/main.c
> @@ -655,13 +655,12 @@ static void corosync_totem_stats_updater (void *data)
> mtt_rx_token = (total_mtt_rx_token / token_count);
> avg_backlog_calc = (total_backlog_calc / token_count);
> avg_token_holdtime = (total_token_holdtime / token_count);
> -
> objdb->object_key_replace (stats->mrp->srp->hdr.handle,
> "mtt_rx_token", strlen("mtt_rx_token"),
> &mtt_rx_token, sizeof (mtt_rx_token));
> objdb->object_key_replace (stats->mrp->srp->hdr.handle,
> "avg_token_workload", strlen("avg_token_workload"),
> - &avg_token_holdtime, sizeof (avg_backlog_calc));
> + &avg_token_holdtime, sizeof (avg_token_holdtime));
> objdb->object_key_replace (stats->mrp->srp->hdr.handle,
> "avg_backlog_calc", strlen("avg_backlog_calc"),
> &avg_backlog_calc, sizeof (avg_backlog_calc));
> @@ -782,8 +781,8 @@ static void corosync_totem_stats_init (void)
> "avg_token_workload", &zero_32,
> sizeof (zero_32), OBJDB_VALUETYPE_UINT32);
> objdb->object_key_create_typed (stats->mrp->srp->hdr.handle,
> - "avg_backlog_calc", &zero_64,
> - sizeof (zero_64), OBJDB_VALUETYPE_UINT64);
> + "avg_backlog_calc", &zero_32,
> + sizeof (zero_32), OBJDB_VALUETYPE_UINT32);
> objdb->object_key_create_typed (stats->mrp->srp->hdr.handle,
> "rx_msg_dropped", &zero_64,
> sizeof (zero_64), OBJDB_VALUETYPE_UINT64);
> diff --git a/trunk/exec/objdb.c b/trunk/exec/objdb.c
> index e26ff14..8dc34c5 100644
> --- a/trunk/exec/objdb.c
> +++ b/trunk/exec/objdb.c
> @@ -1316,6 +1316,8 @@ static int object_key_replace (
> goto error_exit;
> free(object_key->value);
> object_key->value = replacement_value;
> + memset (object_key->value, 0, new_value_len);
> + object_key->value_len = new_value_len;
> }
> if (memcmp (object_key->value, new_value, new_value_len) == 0) {
> value_changed = 0;
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais