summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-rpc-fops.c
diff options
context:
space:
mode:
authorMohammed Azhar Padariyakam <mpadariy@redhat.com>2017-11-03 00:38:17 +0530
committerAmar Tumballi <amarts@redhat.com>2017-11-06 07:44:43 +0000
commite994c47e3b84f0509e380190ca3487f9036858d8 (patch)
tree9b663d26e7825ba4294accd63d080990b4c2fb37 /xlators/protocol/client/src/client-rpc-fops.c
parent2891f993ac1cee6198661682039cf499a0824f2e (diff)
xlators/client-rpc-fops: Fix Coverity Issues
Coverity Id: 557,175,177,184,711,182,180,181,178 from [1] Problem: Unreachable code at client3_3_fgetxattr: 4771 Unreachable code at client3_3_fxattrop: 5087 Unreachable code at client3_3_getxattr: 4890 Unreachable code at client3_3_lookup: 3412 Unreachable code at client3_3_readdir: 5604 Unreachable code at client3_3_readdirp: 5704 Unreachable code at client3_3_xattrop: 4982 NULL checking deref ptr at client3_3_compound: 6045 Unused Value for op_errno at client3_3_getxattr: 4859 Solution: Removed The Unreachable Dead Code Removed NULL Check of dereferenced pointer Removed assignment of op_errno which is overwritten later [1]:https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Change-Id: Ie26a026dd1475c892faf00dd844bf38092e0a780 BUG: 789278 Signed-off-by: Mohammed Azhar Padariyakam <mpadariy@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client-rpc-fops.c')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index 803346b6aef..0561def3aab 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -3409,9 +3409,6 @@ unwind:
if (rsp_iobref)
iobref_unref (rsp_iobref);
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
return 0;
}
@@ -4769,9 +4766,6 @@ client3_3_fgetxattr (call_frame_t *frame, xlator_t *this,
unwind:
CLIENT_STACK_UNWIND (fgetxattr, frame, -1, op_errno, NULL, NULL);
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
if (rsp_iobref)
iobref_unref (rsp_iobref);
@@ -4849,6 +4843,12 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this,
if (args && args->name) {
if (is_client_dump_locks_cmd ((char *)args->name)) {
dict = dict_new ();
+
+ if (!dict) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
ret = client_dump_locks ((char *)args->name,
args->loc->inode,
dict);
@@ -4856,7 +4856,8 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this,
gf_msg (this->name, GF_LOG_WARNING, EINVAL,
PC_MSG_INVALID_ENTRY, "Client dump "
"locks failed");
- op_errno = EINVAL;
+ op_errno = ENOMEM;
+ goto unwind;
}
GF_ASSERT (dict);
@@ -4887,14 +4888,15 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this,
return 0;
unwind:
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
if (rsp_iobref)
iobref_unref (rsp_iobref);
CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL);
+ if (dict) {
+ dict_unref(dict);
+ }
+
GF_FREE (req.xdata.xdata_val);
return 0;
@@ -4988,9 +4990,6 @@ unwind:
GF_FREE (req.dict.dict_val);
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
if (rsp_iobref)
iobref_unref (rsp_iobref);
@@ -5084,9 +5083,6 @@ unwind:
if (rsp_iobref)
iobref_unref (rsp_iobref);
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
GF_FREE (req.xdata.xdata_val);
return 0;
@@ -5601,9 +5597,6 @@ unwind:
if (rsp_iobref)
iobref_unref (rsp_iobref);
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL, NULL);
GF_FREE (req.xdata.xdata_val);
@@ -5701,9 +5694,6 @@ unwind:
if (rsp_iobref)
iobref_unref (rsp_iobref);
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
-
GF_FREE (req.dict.dict_val);
CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL, NULL);
@@ -6042,7 +6032,7 @@ client3_3_compound (call_frame_t *frame, xlator_t *this, void *data)
GF_ASSERT (frame);
- if (!this || !data)
+ if (!this)
goto unwind;
memset (req_vector, 0, sizeof (req_vector));