From 607b91747574bb912477df5dd11c4e31cde4c0bf Mon Sep 17 00:00:00 2001 From: Susant Palai Date: Mon, 17 Sep 2018 12:18:13 +0530 Subject: dht: Coverity fixes CID: 1274236 Issue: Logically dead code (op_errno will never be -1) CID: 1351652 Issue: Dereference after null check. (local->fd is dereferenced anyway and it should not be NULL ever for dht_readdirp_cbk.) Change-Id: Ied9c5f5b72536be1ca944237165acdc62b792e58 updates: bz#789278 Signed-off-by: Susant Palai --- xlators/cluster/dht/src/dht-common.c | 4 +++- xlators/cluster/dht/src/dht-rename.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/dht') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 4ca54a1f5c0..c5d75d4153c 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -6576,7 +6576,9 @@ dht_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, prev = cookie; local = frame->local; - itable = local->fd ? local->fd->inode->table : NULL; + GF_VALIDATE_OR_GOTO(this->name, local->fd, unwind); + + itable = local->fd->inode->table; conf = this->private; GF_VALIDATE_OR_GOTO(this->name, conf, unwind); diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index 57a1a9f8b0c..ed4625c5f94 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -578,7 +578,6 @@ dht_rename_dir(call_frame_t *frame, xlator_t *this) return 0; err: - op_errno = (op_errno == -1) ? errno : op_errno; DHT_STACK_UNWIND(rename, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL, NULL); return 0; -- cgit