summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/posix.c
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2018-10-11 12:12:38 +0530
committerAmar Tumballi <amarts@redhat.com>2018-10-12 05:49:09 +0000
commit09baa5d7fb91d1f50976807f1da0f7bbf177fa00 (patch)
tree0ed25cc87ae3af9e932eb55e95f3715dec5ed0de /xlators/features/locks/src/posix.c
parentb2e592a4a9beb0ef3f8986e3ff3a630981bcad1f (diff)
features/locks: Fix Coverity issues
CID: 1395812 Explicit null dereferenced 1356542 Dereference null return value https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=86261835&defectInstanceId=26407100&mergedDefectId=1395812 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=86261835&defectInstanceId=26407215&mergedDefectId=1356542 Change-Id: I2c20972a8080fa7a70b88eab0688b9cf734bbf24 updates: bz#789278 Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r--xlators/features/locks/src/posix.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 3528e686a96..f08a22d4fc3 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -755,8 +755,8 @@ truncate_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
gf_boolean_t can_block = _gf_true;
int allowed = 1;
- GF_VALIDATE_OR_GOTO("locks", this, unwind);
local = frame->local;
+ GF_VALIDATE_OR_GOTO("locks", this, unwind);
if (op_ret != 0) {
gf_log(this->name, GF_LOG_ERROR,
@@ -854,6 +854,7 @@ unwind:
"truncate failed with "
"ret: %d, error: %s",
op_ret, strerror(op_errno));
+
if (local->op == GF_FOP_TRUNCATE)
loc_wipe(&local->loc[0]);
if (local->xdata)
@@ -2488,6 +2489,8 @@ pl_forget(xlator_t *this, inode_t *inode)
INIT_LIST_HEAD(&entrylks_released);
pl_inode = pl_inode_get(this, inode);
+ if (!pl_inode)
+ return 0;
pthread_mutex_lock(&pl_inode->mutex);
{