1
1

Merge pull request #4200 from rhc54/topic/cov

Silence coverity warnings
Этот коммит содержится в:
Ralph Castain 2017-09-12 10:29:32 -07:00 коммит произвёл GitHub
родитель 637ebf60f9 88eac797fb
Коммит d41069795f
12 изменённых файлов: 39 добавлений и 36 удалений

Просмотреть файл

@ -30,7 +30,7 @@ greek=
# command, or with the date (if "git describe" fails) in the form of # command, or with the date (if "git describe" fails) in the form of
# "date<date>". # "date<date>".
repo_rev=git8684147 repo_rev=git1154ce3
# If tarball_version is not empty, it is used as the version string in # If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in # the tarball filename, regardless of all other versions listed in
@ -44,7 +44,7 @@ tarball_version=
# The date when this release was created # The date when this release was created
date="Sep 11, 2017" date="Sep 12, 2017"
# The shared library version of each of PMIx's public libraries. # The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library # These versions are maintained in accordance with the "Library

Просмотреть файл

@ -214,6 +214,7 @@ typedef uint32_t pmix_rank_t;
#define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace #define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace
#define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc #define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc
#define PMIX_LOCALITY "pmix.loc" // (uint16_t) relative locality of two procs #define PMIX_LOCALITY "pmix.loc" // (uint16_t) relative locality of two procs
#define PMIX_PARENT_ID "pmix.parent" // (pmix_proc_t) process identifier of my parent process
/* size info */ /* size info */
#define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace #define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace
@ -418,6 +419,7 @@ typedef uint32_t pmix_rank_t;
#define PMIX_JOB_CTRL_PROVISION "pmix.jctrl.pvn" // (char*) regex identifying nodes that are to be provisioned #define PMIX_JOB_CTRL_PROVISION "pmix.jctrl.pvn" // (char*) regex identifying nodes that are to be provisioned
#define PMIX_JOB_CTRL_PROVISION_IMAGE "pmix.jctrl.pvnimg" // (char*) name of the image that is to be provisioned #define PMIX_JOB_CTRL_PROVISION_IMAGE "pmix.jctrl.pvnimg" // (char*) name of the image that is to be provisioned
#define PMIX_JOB_CTRL_PREEMPTIBLE "pmix.jctrl.preempt" // (bool) job can be pre-empted #define PMIX_JOB_CTRL_PREEMPTIBLE "pmix.jctrl.preempt" // (bool) job can be pre-empted
#define PMIX_JOB_CTRL_TERMINATE "pmix.jctrl.term" // (bool) politely terminate the specified procs
/* monitoring attributes */ /* monitoring attributes */
#define PMIX_MONITOR_ID "pmix.monitor.id" // (char*) provide a string identifier for this request #define PMIX_MONITOR_ID "pmix.monitor.id" // (char*) provide a string identifier for this request

Просмотреть файл

@ -281,6 +281,11 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return; return;
} }
/* cache the proc id */
(void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
proc.rank = cb->pname.rank;
/* a zero-byte buffer indicates that this recv is being /* a zero-byte buffer indicates that this recv is being
* completed due to a lost connection */ * completed due to a lost connection */
if (PMIX_BUFFER_IS_EMPTY(buf)) { if (PMIX_BUFFER_IS_EMPTY(buf)) {
@ -288,10 +293,6 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
goto done; goto done;
} }
/* cache the proc id */
(void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
proc.rank = cb->pname.rank;
/* unpack the status */ /* unpack the status */
cnt = 1; cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,

Просмотреть файл

@ -218,13 +218,6 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
"pmix:client recv callback activated with %d bytes", "pmix:client recv callback activated with %d bytes",
(NULL == buf) ? -1 : (int)buf->bytes_used); (NULL == buf) ? -1 : (int)buf->bytes_used);
/* a zero-byte buffer indicates that this recv is being
* completed due to a lost connection */
if (PMIX_BUFFER_IS_EMPTY(buf)) {
ret = PMIX_ERR_UNREACH;
goto report;
}
/* init */ /* init */
memset(nspace, 0, PMIX_MAX_NSLEN+1); memset(nspace, 0, PMIX_MAX_NSLEN+1);
@ -232,6 +225,12 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
ret = PMIX_ERR_BAD_PARAM; ret = PMIX_ERR_BAD_PARAM;
goto report; goto report;
} }
/* a zero-byte buffer indicates that this recv is being
* completed due to a lost connection */
if (PMIX_BUFFER_IS_EMPTY(buf)) {
ret = PMIX_ERR_UNREACH;
goto report;
}
/* unpack the returned status */ /* unpack the returned status */
cnt = 1; cnt = 1;

Просмотреть файл

@ -124,7 +124,9 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
if (PMIX_RANGE_PROC_LOCAL != range) { if (PMIX_RANGE_PROC_LOCAL != range) {
/* create the msg object */ /* create the msg object */
msg = PMIX_NEW(pmix_buffer_t); msg = PMIX_NEW(pmix_buffer_t);
if (NULL == msg) {
return PMIX_ERR_NOMEM;
}
/* pack the command */ /* pack the command */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &cmd, 1, PMIX_COMMAND); PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, msg, &cmd, 1, PMIX_COMMAND);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
@ -263,9 +265,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
cleanup: cleanup:
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"client: notifying server - unable to send"); "client: notifying server - unable to send");
if (NULL != msg) {
PMIX_RELEASE(msg); PMIX_RELEASE(msg);
}
/* we were unable to send anything, so we just return the error */ /* we were unable to send anything, so we just return the error */
return rc; return rc;
} }

Просмотреть файл

@ -42,7 +42,7 @@
#include "src/class/pmix_list.h" #include "src/class/pmix_list.h"
#include "src/threads/threads.h" #include "src/threads/threads.h"
pmix_lock_t pmix_global_lock = { PMIX_EXPORT pmix_lock_t pmix_global_lock = {
.mutex = PMIX_MUTEX_STATIC_INIT, .mutex = PMIX_MUTEX_STATIC_INIT,
.cond = PMIX_CONDITION_STATIC_INIT, .cond = PMIX_CONDITION_STATIC_INIT,
.active = false .active = false

Просмотреть файл

@ -191,7 +191,7 @@ static int pdlopen_foreachfile(const char *search_path,
char *abs_name = NULL; char *abs_name = NULL;
ret = asprintf(&abs_name, "%s/%s", dirs[i], de->d_name); ret = asprintf(&abs_name, "%s/%s", dirs[i], de->d_name);
if (0 > ret) { if (0 > ret) {
return PMIX_ERR_NOMEM; goto error;
} }
if (NULL == abs_name) { if (NULL == abs_name) {
ret = PMIX_ERR_IN_ERRNO; ret = PMIX_ERR_IN_ERRNO;

Просмотреть файл

@ -280,12 +280,12 @@ PMIX_EXPORT extern int pmix_ptl_base_output;
} \ } \
} while (0) } while (0)
#define CLOSE_THE_SOCKET(socket) \ #define CLOSE_THE_SOCKET(s) \
do { \ do { \
if (0 <= socket) { \ if (0 <= (s)) { \
shutdown(socket, 2); \ shutdown((s), 2); \
close(socket); \ close((s)); \
socket = -1; \ (s) = -1; \
} \ } \
} while (0) } while (0)

Просмотреть файл

@ -65,8 +65,8 @@
#endif #endif
const char pmix_version_string[] = PMIX_IDENT_STRING; const char pmix_version_string[] = PMIX_IDENT_STRING;
int pmix_initialized = 0; PMIX_EXPORT int pmix_initialized = 0;
bool pmix_init_called = false; PMIX_EXPORT bool pmix_init_called = false;
/* we have to export the pmix_globals object so /* we have to export the pmix_globals object so
* all plugins can access it. However, it is included * all plugins can access it. However, it is included
* in the pmix_rename.h file for external protection */ * in the pmix_rename.h file for external protection */

Просмотреть файл

@ -59,7 +59,7 @@ extern const char pmix_version_string[];
* @retval PMIX_ERROR Upon failure. * @retval PMIX_ERROR Upon failure.
* *
*/ */
pmix_status_t pmix_rte_init(pmix_proc_type_t type, PMIX_EXPORT pmix_status_t pmix_rte_init(pmix_proc_type_t type,
pmix_info_t info[], size_t ninfo, pmix_info_t info[], size_t ninfo,
pmix_ptl_cbfunc_t cbfunc); pmix_ptl_cbfunc_t cbfunc);
@ -67,13 +67,13 @@ pmix_status_t pmix_rte_init(pmix_proc_type_t type,
* Finalize the PMIX layer, including the MCA system. * Finalize the PMIX layer, including the MCA system.
* *
*/ */
void pmix_rte_finalize(void); PMIX_EXPORT void pmix_rte_finalize(void);
/** /**
* Internal function. Do not call. * Internal function. Do not call.
*/ */
pmix_status_t pmix_register_params(void); PMIX_EXPORT pmix_status_t pmix_register_params(void);
pmix_status_t pmix_deregister_params(void); PMIX_EXPORT pmix_status_t pmix_deregister_params(void);
END_C_DECLS END_C_DECLS

Просмотреть файл

@ -486,9 +486,7 @@ static void _deregister_nspace(int sd, short args, void *cbdata)
/* let our local storage clean up */ /* let our local storage clean up */
PMIX_GDS_DEL_NSPACE(rc, cd->proc.nspace); PMIX_GDS_DEL_NSPACE(rc, cd->proc.nspace);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
/* release any job-level messaging resources */ /* release any job-level messaging resources */
pmix_pnet.local_app_finalized(cd->proc.nspace); pmix_pnet.local_app_finalized(cd->proc.nspace);

Просмотреть файл

@ -402,9 +402,12 @@ char* pmix_find_absolute_path( char* app_name )
if( NULL != abs_app_name ) { if( NULL != abs_app_name ) {
char* resolved_path = (char*)malloc(PMIX_PATH_MAX); char* resolved_path = (char*)malloc(PMIX_PATH_MAX);
if (NULL == realpath( abs_app_name, resolved_path )) { if (NULL == realpath( abs_app_name, resolved_path )) {
free(resolved_path);
return NULL; return NULL;
} }
if( abs_app_name != app_name ) free(abs_app_name); if( abs_app_name != app_name ) {
free(abs_app_name);
}
return resolved_path; return resolved_path;
} }
return NULL; return NULL;