summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2014-12-19 16:38:43 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2014-12-23 07:22:38 -0800
commit0299f7f0f7c4d8e5e7e04d8bc1787ecbee6dbe52 (patch)
treed810a1f0e17fa7707a0b5191f2604370c57b594e /xlators
parent85427a23c238499137cbfaafdb7b6ad27f67506a (diff)
afr: coverity fixes
Some fixes for the 17th Dec 2014 run. https://scan6.coverity.com:8443/reports.htm#v31028/p10714/g31029 Change-Id: Ia4410ef87a56fffb61803d0a4e62369b058e1cfb BUG: 1176089 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/9314 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c4
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c7
-rw-r--r--xlators/cluster/afr/src/afr-inode-read.c20
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c2
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c4
-rw-r--r--xlators/cluster/afr/src/pump.c3
6 files changed, 21 insertions, 19 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index aefad8be959..5d6737f72df 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -485,10 +485,12 @@ afr_selfheal_enabled (xlator_t *this)
{
afr_private_t *priv = NULL;
gf_boolean_t data = _gf_false;
+ int ret = 0;
priv = this->private;
- gf_string2boolean (priv->data_self_heal, &data);
+ ret = gf_string2boolean (priv->data_self_heal, &data);
+ GF_ASSERT (!ret);
return data || priv->metadata_self_heal || priv->entry_self_heal;
}
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index f5c385c34a4..4cee1ed9bea 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -314,7 +314,6 @@ afr_mark_new_entry_changelog (call_frame_t *frame, xlator_t *this)
goto out;
new_local->pending = changelog;
- changelog = NULL;
uuid_copy (new_local->loc.gfid, local->cont.dir_fop.buf.ia_gfid);
new_local->loc.inode = inode_ref (local->inode);
@@ -335,8 +334,6 @@ afr_mark_new_entry_changelog (call_frame_t *frame, xlator_t *this)
new_frame = NULL;
out:
- if (changelog)
- afr_matrix_cleanup (changelog, priv->child_count);
if (new_frame)
AFR_STACK_DESTROY (new_frame);
if (xattr)
@@ -1103,8 +1100,10 @@ afr_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
priv = this->private;
transaction_frame = copy_frame (frame);
- if (!transaction_frame)
+ if (!transaction_frame) {
op_errno = ENOMEM;
+ goto out;
+ }
local = AFR_FRAME_INIT (transaction_frame, op_errno);
if (!local)
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c
index 210d710a2b3..e64070e1bcd 100644
--- a/xlators/cluster/afr/src/afr-inode-read.c
+++ b/xlators/cluster/afr/src/afr-inode-read.c
@@ -766,7 +766,7 @@ unlock:
}
len = dict_serialized_length (local->dict);
- if (len == 0) {
+ if (len <= 0) {
goto unwind;
}
@@ -957,7 +957,7 @@ afr_fgetxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
}
if (!dict || (op_ret < 0))
- goto out;
+ goto unlock;
if (!local->dict)
local->dict = dict_new ();
@@ -967,7 +967,7 @@ afr_fgetxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
local->cont.getxattr.name,
&xattr);
if (ret)
- goto out;
+ goto unlock;
xattr = gf_strdup (xattr);
@@ -978,14 +978,14 @@ afr_fgetxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Cannot set xattr cookie key");
- goto out;
+ goto unlock;
}
local->cont.getxattr.xattr_len
+= strlen (xattr) + 1;
}
}
-out:
+unlock:
UNLOCK (&frame->lock);
if (!callcnt) {
@@ -1040,6 +1040,7 @@ out:
dict_unref (nxattr);
}
+out:
return ret;
}
@@ -1080,7 +1081,7 @@ afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
}
if (!dict || (op_ret < 0))
- goto out;
+ goto unlock;
if (!local->dict)
local->dict = dict_new ();
@@ -1090,7 +1091,7 @@ afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
local->cont.getxattr.name,
&xattr);
if (ret)
- goto out;
+ goto unlock;
xattr = gf_strdup (xattr);
@@ -1101,13 +1102,13 @@ afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Cannot set xattr cookie key");
- goto out;
+ goto unlock;
}
local->cont.getxattr.xattr_len += strlen (xattr) + 1;
}
}
- out:
+unlock:
UNLOCK (&frame->lock);
if (!callcnt) {
@@ -1160,6 +1161,7 @@ afr_getxattr_pathinfo_cbk (call_frame_t *frame, void *cookie,
dict_unref (nxattr);
}
+out:
return ret;
}
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 0c3ba920937..0c96d069ae5 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -648,7 +648,7 @@ afr_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
int op_errno = ENOMEM;
transaction_frame = copy_frame (frame);
- if (!frame)
+ if (!transaction_frame)
goto out;
local = AFR_FRAME_INIT (transaction_frame, op_errno);
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index bb582b5940f..3cb073ecfc3 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1327,10 +1327,10 @@ afr_set_delayed_post_op (call_frame_t *frame, xlator_t *this)
return;
local = frame->local;
- if (!local->transaction.eager_lock_on)
+ if (!local)
return;
- if (!local)
+ if (!local->transaction.eager_lock_on)
return;
if (!local->fd)
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index c6923fa45ac..747b5ba2592 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -1429,6 +1429,7 @@ pump_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
strlen (AFR_XATTR_PREFIX))) {
op_errno = ENODATA;
+ ret = -1;
goto out;
}
@@ -1436,14 +1437,12 @@ pump_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
gf_log (this->name, GF_LOG_DEBUG,
"Hit pump command - status");
pump_execute_status (frame, this);
- ret = 0;
goto out;
}
}
afr_getxattr (frame, this, loc, name, xdata);
- ret = 0;
out:
if (ret < 0)
AFR_STACK_UNWIND (getxattr, frame, -1, op_errno, NULL, NULL);