btl/openib: fix more coverity issues
CID 1269931 Uninitialized scalar variable (UNINIT) Initialize complete async message. This was not a bug but the fix contributes to valgrind cleanness (uninitialed write). CID 1269915 Unintended sign extension (SIGN_EXTENSION) Should never happen. Quieting this by explicitly casting to uint64_t. CID 1269824 Dereference null return value (NULL_RETURNS) It is impossible for opal_list_remove_first to return NULL if opal_list_is_empty returns false. I refactored the code in question to not use opal_list_is_empty but loop until NULL is returned by opal_list_remove_first. That will quiet the issue. CID 1269913 Dereference before null check (REVERSE_INULL) The storage parameter should never be NULL. The check intended to check if *storage was NULL not storage. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
32d4d7b6ea
Коммит
43d678e7ca
@ -641,7 +641,9 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mca_btl_openib_component.use_async_event_thread) {
|
if(mca_btl_openib_component.use_async_event_thread) {
|
||||||
mca_btl_openib_async_cmd_t async_command;
|
mca_btl_openib_async_cmd_t async_command = {.a_cmd = OPENIB_ASYNC_CMD_FD_ADD,
|
||||||
|
.fd = device->ib_dev_context->async_fd,
|
||||||
|
.qp = NULL};
|
||||||
|
|
||||||
/* start the async even thread if it is not already started */
|
/* start the async even thread if it is not already started */
|
||||||
if (start_async_event_thread() != OPAL_SUCCESS)
|
if (start_async_event_thread() != OPAL_SUCCESS)
|
||||||
@ -649,8 +651,6 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
|
|||||||
|
|
||||||
device->got_fatal_event = false;
|
device->got_fatal_event = false;
|
||||||
device->got_port_event = false;
|
device->got_port_event = false;
|
||||||
async_command.a_cmd = OPENIB_ASYNC_CMD_FD_ADD;
|
|
||||||
async_command.fd = device->ib_dev_context->async_fd;
|
|
||||||
if (write(mca_btl_openib_component.async_pipe[1],
|
if (write(mca_btl_openib_component.async_pipe[1],
|
||||||
&async_command, sizeof(mca_btl_openib_async_cmd_t))<0){
|
&async_command, sizeof(mca_btl_openib_async_cmd_t))<0){
|
||||||
BTL_ERROR(("Failed to write to pipe [%d]",errno));
|
BTL_ERROR(("Failed to write to pipe [%d]",errno));
|
||||||
@ -699,7 +699,7 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
|
|||||||
if (mca_btl_openib_component.max_eager_rdma > 0 &&
|
if (mca_btl_openib_component.max_eager_rdma > 0 &&
|
||||||
device->use_eager_rdma) {
|
device->use_eager_rdma) {
|
||||||
device->eager_rdma_buffers =
|
device->eager_rdma_buffers =
|
||||||
(mca_btl_base_endpoint_t **) calloc(mca_btl_openib_component.max_eager_rdma * device->btls,
|
(mca_btl_base_endpoint_t **) calloc((size_t) mca_btl_openib_component.max_eager_rdma * device->btls,
|
||||||
sizeof(mca_btl_openib_endpoint_t*));
|
sizeof(mca_btl_openib_endpoint_t*));
|
||||||
if(NULL == device->eager_rdma_buffers) {
|
if(NULL == device->eager_rdma_buffers) {
|
||||||
BTL_ERROR(("Memory allocation fails"));
|
BTL_ERROR(("Memory allocation fails"));
|
||||||
|
@ -427,14 +427,15 @@ static inline mca_btl_openib_coalesced_frag_t *alloc_coalesced_frag(void)
|
|||||||
do { \
|
do { \
|
||||||
opal_free_list_return (to_base_frag(frag)->list, \
|
opal_free_list_return (to_base_frag(frag)->list, \
|
||||||
(opal_free_list_item_t*)(frag)); \
|
(opal_free_list_item_t*)(frag)); \
|
||||||
} while(0);
|
} while(0)
|
||||||
|
|
||||||
#define MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(list) \
|
#define MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS(list) \
|
||||||
while(!opal_list_is_empty(list)){ \
|
do { \
|
||||||
opal_list_item_t *frag_item; \
|
opal_list_item_t *_frag_item; \
|
||||||
frag_item = opal_list_remove_first(list); \
|
while (NULL != (_frag_item = opal_list_remove_first(list))) { \
|
||||||
MCA_BTL_IB_FRAG_RETURN(frag_item); \
|
MCA_BTL_IB_FRAG_RETURN(_frag_item); \
|
||||||
} \
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
struct mca_btl_openib_module_t;
|
struct mca_btl_openib_module_t;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved.
|
* Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved.
|
||||||
* Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2006-2007 Voltaire All rights reserved.
|
* Copyright (c) 2006-2007 Voltaire All rights reserved.
|
||||||
* Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved.
|
||||||
@ -105,6 +105,8 @@ static int reg_string(const char* param_name,
|
|||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
|
assert (NULL != storage);
|
||||||
|
|
||||||
/* The MCA variable system will not change this pointer */
|
/* The MCA variable system will not change this pointer */
|
||||||
*storage = (char *) default_value;
|
*storage = (char *) default_value;
|
||||||
index = mca_base_component_var_register(&mca_btl_openib_component.super.btl_version,
|
index = mca_base_component_var_register(&mca_btl_openib_component.super.btl_version,
|
||||||
@ -117,7 +119,7 @@ static int reg_string(const char* param_name,
|
|||||||
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != (flags & REGSTR_EMPTY_OK) && (NULL == storage || 0 == strlen(*storage))) {
|
if (0 != (flags & REGSTR_EMPTY_OK) && (NULL == *storage || 0 == strlen(*storage))) {
|
||||||
opal_output(0, "Bad parameter value for parameter \"%s\"",
|
opal_output(0, "Bad parameter value for parameter \"%s\"",
|
||||||
param_name);
|
param_name);
|
||||||
return OPAL_ERR_BAD_PARAM;
|
return OPAL_ERR_BAD_PARAM;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user