Skip to content

Commit bc1f33f

Browse files
Atin Mukherjeegluster-ant
Atin Mukherjee
authored andcommitted
glusterd, rpc, glusterfsd: fix coverity defects and put required annotations
1404965 - Null pointer dereference 1404316 - Program hangs 1401715 - Program hangs 1401713 - Program hangs Updates: bz#789278 Change-Id: I6e6575daafcb067bc910445f82a9d564f43b75a2 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
1 parent 2d6e7c5 commit bc1f33f

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

glusterfsd/src/glusterfsd-mgmt.c

+1
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,7 @@ glusterfs_handle_svc_detach(rpcsvc_request_t *req)
11811181
ret = 0;
11821182
goto out;
11831183
}
1184+
/* coverity[ORDER_REVERSAL] */
11841185
ret = glusterfs_process_svc_detach(ctx, volfile_tmp);
11851186
if (ret) {
11861187
UNLOCK(&ctx->volfile_lock);

rpc/rpc-transport/socket/src/socket.c

+1
Original file line numberDiff line numberDiff line change
@@ -3801,6 +3801,7 @@ socket_listen(rpc_transport_t *this)
38013801
}
38023802
}
38033803

3804+
/* coverity[SLEEP] */
38043805
ret = __socket_server_bind(this);
38053806

38063807
if ((ret == -EADDRINUSE) || (ret == -1)) {

xlators/mgmt/glusterd/src/glusterd-handler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,7 @@ glusterd_friend_remove(uuid_t uuid, char *hostname)
32933293
ret = glusterd_peerinfo_cleanup(peerinfo);
32943294
out:
32953295
gf_msg_debug(THIS->name, 0, "returning %d", ret);
3296-
3296+
/* coverity[LOCK] */
32973297
return ret;
32983298
}
32993299

xlators/mgmt/glusterd/src/glusterd-shd-svc.c

+2
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ glusterd_shdsvc_start(glusterd_svc_t *svc, int flags)
482482
volinfo->volname, glusterd_proc_get_pid(&svc->proc));
483483
glusterd_shd_svcproc_cleanup(&volinfo->shd);
484484
glusterd_volinfo_unref(volinfo);
485+
goto out1;
485486
}
486487
goto out;
487488
}
@@ -494,6 +495,7 @@ glusterd_shdsvc_start(glusterd_svc_t *svc, int flags)
494495
glusterd_shd_svcproc_cleanup(&volinfo->shd);
495496
if (volinfo)
496497
glusterd_volinfo_unref(volinfo);
498+
out1:
497499
gf_msg_debug(THIS->name, 0, "Returning %d", ret);
498500

499501
return ret;

xlators/mgmt/glusterd/src/glusterd-volume-ops.c

+1
Original file line numberDiff line numberDiff line change
@@ -2492,6 +2492,7 @@ glusterd_start_volume(glusterd_volinfo_t *volinfo, int flags, gf_boolean_t wait)
24922492
attach_brick_callback can also call store_volinfo for same
24932493
volume to update volinfo on disk
24942494
*/
2495+
/* coverity[ORDER_REVERSAL] */
24952496
LOCK(&volinfo->lock);
24962497
ret = glusterd_store_volinfo(volinfo, verincrement);
24972498
UNLOCK(&volinfo->lock);

xlators/protocol/client/src/client.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ int
6464
client_is_last_child_down(xlator_t *this, int32_t event, struct rpc_clnt *rpc)
6565
{
6666
rpc_clnt_connection_t *conn = NULL;
67+
clnt_conf_t *conf = NULL;
6768
int ret = 0;
6869

69-
clnt_conf_t *conf = this->private;
70-
if (!this || !rpc || !conf)
70+
if (!this || !rpc)
71+
goto out;
72+
73+
conf = this->private;
74+
if (!conf)
7175
goto out;
7276

7377
if (!conf->parent_down)

0 commit comments

Comments
 (0)