Skip to content

Commit

Permalink
CORE: coverity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shimmybalsam committed Jul 12, 2023
1 parent 1c57838 commit de65225
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/components/tl/sharp/tl_sharp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ ucc_status_t ucc_tl_sharp_context_create_epilog(ucc_base_context_t *context)
return UCC_OK;
}

memset(&set.map, 0, sizeof(ucc_ep_map_t));
set.map.type = UCC_EP_MAP_FULL;
set.myrank = UCC_TL_CTX_OOB(sharp_ctx).oob_ep;
set.map.ep_num = UCC_TL_CTX_OOB(sharp_ctx).n_oob_eps;
Expand All @@ -447,6 +448,7 @@ ucc_status_t ucc_tl_sharp_context_create_epilog(ucc_base_context_t *context)
status = ucc_tl_sharp_context_init(sharp_ctx, &sharp_ctx->sharp_context,
&sharp_ctx->oob_ctx, topo);
if (status != UCC_OK) {
ucc_topo_cleanup(topo);
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/ucc_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ UCC_CORE_PROFILE_FUNC(ucc_status_t, ucc_collective_init,
}

/* TO discuss: maybe we want to pass around user pointer ? */
op_args.mask = 0;
memset(&op_args, 0, sizeof(ucc_base_coll_args_t));
memcpy(&op_args.args, coll_args, sizeof(ucc_coll_args_t));
op_args.team = team;

Expand Down
3 changes: 3 additions & 0 deletions src/core/ucc_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ ucc_status_t ucc_context_create_proc_info(ucc_lib_h lib,
ucc_debug("TL UCP context is not available, "
"service team can not be created");
} else {
memset(&t_params.map, 0, sizeof(ucc_ep_map_t));
memset(&t_params.params, 0, sizeof(ucc_team_params_t));
t_params.params.mask = UCC_TEAM_PARAM_FIELD_EP |
UCC_TEAM_PARAM_FIELD_EP_RANGE |
UCC_TEAM_PARAM_FIELD_OOB;
Expand Down Expand Up @@ -1070,6 +1072,7 @@ ucc_status_t ucc_context_get_attr(ucc_context_t *context,
ucc_base_ctx_attr_t attr;
ucc_tl_lib_t * tl_lib;

memset(&attr.attr, 0, sizeof(ucc_context_attr_t));
attr.attr.mask = UCC_CONTEXT_ATTR_FIELD_WORK_BUFFER_SIZE;
attr.attr.global_work_buffer_size = 0;
for (i = 0; i < context->n_tl_ctx; i++) {
Expand Down
3 changes: 2 additions & 1 deletion src/core/ucc_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static ucc_status_t ucc_cl_lib_init(const ucc_lib_params_t *user_params,
}

lib->cl_attrs = (ucc_cl_lib_attr_t *)
ucc_malloc(sizeof(ucc_cl_lib_attr_t) * n_cls, "cl_attrs");
ucc_calloc(n_cls, sizeof(ucc_cl_lib_attr_t), "cl_attrs");
if (!lib->cl_attrs) {
ucc_error("failed to allocate %zd bytes for cl_attrs",
sizeof(ucc_cl_lib_attr_t) * n_cls);
Expand All @@ -103,6 +103,7 @@ static ucc_status_t ucc_cl_lib_init(const ucc_lib_params_t *user_params,
params.mask |= UCC_LIB_PARAM_FIELD_THREAD_MODE;
params.thread_mode = UCC_THREAD_SINGLE;
}
memset(&b_params, 0, sizeof(ucc_base_lib_params_t));
ucc_copy_lib_params(&b_params.params, &params);
ucc_assert(config->cls.count >= 1);
lib->specific_cls_requested = (0 == ucc_cl_requested(config, UCC_CL_ALL));
Expand Down
13 changes: 8 additions & 5 deletions src/utils/ucc_coll_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ ucc_ep_map_from_array_generic(void **array, ucc_rank_t size,
int64_t stride;
ucc_rank_t i;

memset(&map, 0, sizeof(ucc_ep_map_t));
map.ep_num = size;
if (size > 1) {
/* try to detect strided pattern */
Expand Down Expand Up @@ -550,13 +551,15 @@ void ucc_coll_str(const ucc_coll_task_t *task, char *str, size_t len,

if (task->team->context->lib->log_component.name[0] == 'C') {
/* it's not CL BASIC task */
strncpy(cl_info, task->team->context->lib->log_component.name,
sizeof(cl_info));
ucc_strncpy_safe(cl_info,
task->team->context->lib->log_component.name,
sizeof(cl_info));
ucc_coll_task_components_str(task, tl_info, &tl_info_len);
} else {
strncpy(cl_info, "CL_BASIC", sizeof(cl_info));
strncpy(tl_info , task->team->context->lib->log_component.name,
sizeof(tl_info));
ucc_strncpy_safe(cl_info, "CL_BASIC", sizeof(cl_info));
ucc_strncpy_safe(tl_info,
task->team->context->lib->log_component.name,
sizeof(tl_info));
}
ucc_coll_args_str(&task->bargs.args, team->rank, team->size, str, len);
rc = ucc_snprintf_safe(task_info, sizeof(task_info),
Expand Down

0 comments on commit de65225

Please sign in to comment.