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 <sebastien.buisson@bull.net>
Change-Id: I83a7dd3ae4a027bf0ebced572245bc4fff35e119
Reviewed-on: http://review.whamcloud.com/3939
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet_process_id_t peer;
int err;
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);
err = ptlrpc_uuid_to_peer(uuid, &peer, &self);
if (err != 0) {
CNETERR("cannot find peer %s!\n", uuid->uuid);
+ /* 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))
if (param->quiet || !(param->verbose & VERBOSE_DETAIL))
+ /* coverity[uninit_use_in_call] */
llapi_printf(LLAPI_MSG_NORMAL, "%d\n", mdtidx);
else
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);
llapi_printf(LLAPI_MSG_NORMAL, "%s\nmdt_index:\t%d\n",
path, mdtidx);
+ /* 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;
rc = write(fd, buf, 1);
if (rc < 0)
rc = -errno;
{
struct sigaction sigact;
{
struct sigaction sigact;
+ /* sigact initialization */
sigact.sa_handler = signal_server;
sigfillset(&sigact.sa_mask);
sigact.sa_flags = SA_RESTART;
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();
sigaction(SIGINT, &sigact, NULL);
shmem_cleanup();