From: Sebastien Buisson Date: Tue, 11 Sep 2012 14:43:33 +0000 (+0200) Subject: LU-1889 build: fix false 'uninitialized scalar variable' errs X-Git-Tag: 2.3.54~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=acce09601585c6481012065020ef08f9bf871340;ds=sidebyside LU-1889 build: fix false 'uninitialized scalar variable' errs Fix false 'uninitialized scalar variable' errors found by Coverity version 6.0.3: Uninitialized scalar variable (UNINIT) Using uninitialized value, element or field when calling function. Signed-off-by: Sebastien Buisson Change-Id: I83a7dd3ae4a027bf0ebced572245bc4fff35e119 Reviewed-on: http://review.whamcloud.com/3939 Tested-by: Hudson Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 45899c8..f8561b9 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -76,6 +76,9 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid) lnet_process_id_t peer; int err; + /* ptlrpc_uuid_to_peer() initializes its 2nd parameter + * before accessing its values. */ + /* coverity[uninit_use_in_call] */ err = ptlrpc_uuid_to_peer(uuid, &peer, &self); if (err != 0) { CNETERR("cannot find peer %s!\n", uuid->uuid); diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index ab42640..8d8143e 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2690,9 +2690,15 @@ static int cb_get_mdt_index(char *path, DIR *parent, DIR *d, void *data, return ret; } + /* The 'LASSERT(parent != NULL || d != NULL);' guarantees + * that either 'd' or 'parent' is not null. + * So in all cases llapi_file_fget_mdtidx() is called, + * thus initializing 'mdtidx'. */ if (param->quiet || !(param->verbose & VERBOSE_DETAIL)) + /* coverity[uninit_use_in_call] */ llapi_printf(LLAPI_MSG_NORMAL, "%d\n", mdtidx); else + /* coverity[uninit_use_in_call] */ llapi_printf(LLAPI_MSG_NORMAL, "%s\nmdt_index:\t%d\n", path, mdtidx); @@ -2858,6 +2864,8 @@ int llapi_ping(char *obd_type, char *obd_name) return rc; } + /* The purpose is to send a byte as a ping, whatever this byte is. */ + /* coverity[uninit_use_in_call] */ rc = write(fd, buf, 1); if (rc < 0) rc = -errno; diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 7ddbf8a..ad3ec68 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -3002,9 +3002,11 @@ void obd_finalize(int argc, char **argv) { struct sigaction sigact; + /* sigact initialization */ sigact.sa_handler = signal_server; sigfillset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; + /* coverity[uninit_use_in_call] */ sigaction(SIGINT, &sigact, NULL); shmem_cleanup();