osc: fixed issues identified by coverity
Fix CID 1324733: Null pointer dereferences (FORWARD_NULL) Fix CID 1324734: Null pointer dereferences (FORWARD_NULL) Fix CID 1324735: Null pointer dereferences (FORWARD_NULL) Fix CID 1324736: Null pointer dereferences (FORWARD_NULL) Fix CID 1324737: Null pointer dereferences (FORWARD_NULL) Fix CID 1324751: Memory - illegal accesses (USE_AFTER_FREE) Fix CID 1324750: (USE_AFTER_FREE) Fix CID 1324749: Memory - corruptions (USE_AFTER_FREE) Fix CID 1324748: Memory - illegal accesses (USE_AFTER_FREE) Fix CID 1324747: (USE_AFTER_FREE) Fix CID 1324746: Memory - corruptions (USE_AFTER_FREE) Add missing return on an error path. Fix CID 1324745: Code maintainability issues (UNUSED_VALUE) Ignore return code from barrier. It was not being used anyway. Fix CID 1324738: Null pointer dereferences (FORWARD_NULL) Fix CID 1324741: Null pointer dereferences (REVERSE_INULL) module->selected_btl can not be NULL in osc/rdma during normal operation. Removed the unnecessary NULL check. Fix CID 1324752: Memory - illegal accesses (USE_AFTER_FREE) Move ompi_osc_pt2pt_module_lock_remove to before the lock is freed. Fix CID 1324744: Uninitialized variables (UNINIT) Fix CID 1324743: Uninitialized variables (UNINIT) This array is not used unitialized but there is no reason not to use calloc here to silence the warning. The following CID is a false positive: 1324742. I will mark it such in coverity. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
1197455999
Коммит
974061c38f
@ -79,13 +79,14 @@ static ompi_osc_pt2pt_peer_t **ompi_osc_pt2pt_get_peers (ompi_osc_pt2pt_module_t
|
||||
int *ranks1, *ranks2;
|
||||
int ret;
|
||||
|
||||
ranks1 = malloc (sizeof(int) * size);
|
||||
ranks2 = malloc (sizeof(int) * size);
|
||||
peers = malloc (sizeof (ompi_osc_pt2pt_peer_t *) * size);
|
||||
ranks1 = calloc (size, sizeof(int));
|
||||
ranks2 = calloc (size, sizeof(int));
|
||||
peers = calloc (size, sizeof (ompi_osc_rdma_peer_t *));
|
||||
if (NULL == ranks1 || NULL == ranks2 || NULL == peers) {
|
||||
free (ranks1);
|
||||
free (ranks2);
|
||||
free (peers);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < size ; ++i) {
|
||||
|
@ -55,8 +55,8 @@ int ompi_osc_pt2pt_free(ompi_win_t *win)
|
||||
|
||||
/* finish with a barrier */
|
||||
if (ompi_group_size(win->w_group) > 1) {
|
||||
ret = module->comm->c_coll.coll_barrier(module->comm,
|
||||
module->comm->c_coll.coll_barrier_module);
|
||||
(void) module->comm->c_coll.coll_barrier (module->comm,
|
||||
module->comm->c_coll.coll_barrier_module);
|
||||
}
|
||||
|
||||
/* remove from component information */
|
||||
|
@ -408,6 +408,8 @@ static int ompi_osc_pt2pt_unlock_internal (int target, ompi_win_t *win)
|
||||
}
|
||||
|
||||
OPAL_THREAD_LOCK(&module->lock);
|
||||
ompi_osc_pt2pt_module_lock_remove (module, lock);
|
||||
|
||||
if (-1 != lock->sync.lock.target) {
|
||||
ompi_osc_pt2pt_sync_return (lock);
|
||||
} else {
|
||||
@ -415,7 +417,6 @@ static int ompi_osc_pt2pt_unlock_internal (int target, ompi_win_t *win)
|
||||
}
|
||||
|
||||
--module->passive_target_access_epoch;
|
||||
ompi_osc_pt2pt_module_lock_remove (module, lock);
|
||||
|
||||
OPAL_THREAD_UNLOCK(&module->lock);
|
||||
|
||||
|
@ -103,13 +103,14 @@ static ompi_osc_rdma_peer_t **ompi_osc_rdma_get_peers (ompi_osc_rdma_module_t *m
|
||||
int *ranks1, *ranks2;
|
||||
int ret;
|
||||
|
||||
ranks1 = malloc (sizeof(int) * size);
|
||||
ranks2 = malloc (sizeof(int) * size);
|
||||
peers = malloc (sizeof (ompi_osc_rdma_peer_t *) * size);
|
||||
ranks1 = calloc (size, sizeof(int));
|
||||
ranks2 = calloc (size, sizeof(int));
|
||||
peers = calloc (size, sizeof (ompi_osc_rdma_peer_t *));
|
||||
if (NULL == ranks1 || NULL == ranks2 || NULL == peers) {
|
||||
free (ranks1);
|
||||
free (ranks2);
|
||||
free (peers);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < size ; ++i) {
|
||||
|
@ -231,7 +231,7 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base)
|
||||
OPAL_OUTPUT_VERBOSE((5, ompi_osc_base_framework.framework_output, "Detaching memory region %p-%p at index %d",
|
||||
base, (void *)((intptr_t) base + region->len), region_index));
|
||||
|
||||
if (module->selected_btl && module->selected_btl->btl_register_mem) {
|
||||
if (module->selected_btl->btl_register_mem) {
|
||||
ompi_osc_rdma_deregister (module, module->dynamic_handles[region_index].btl_handle);
|
||||
|
||||
if (region_index < region_count - 1) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user