diff options
| author | hari gowtham <hgowtham@redhat.com> | 2017-11-02 18:13:17 +0530 | 
|---|---|---|
| committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-11-16 15:07:12 +0000 | 
| commit | 0284bd630baa376b00d334d6339272c896960473 (patch) | |
| tree | 13d730eafedabfbdd187030e15014d36a67e6c56 /xlators/cluster/dht/src | |
| parent | 3bf2ba3fb4910a4e9ba6ea7850f3737c9c285fe8 (diff) | |
tier: coverity fix for tier-common.c
fix for the coverity id:
258, 162
Change-Id: I35ba21e37e186b7c1ce54faf5b24f48858e6fc70
BUG: 789278
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src')
| -rw-r--r-- | xlators/cluster/dht/src/tier-common.c | 33 | 
1 files changed, 5 insertions, 28 deletions
diff --git a/xlators/cluster/dht/src/tier-common.c b/xlators/cluster/dht/src/tier-common.c index b2abda73265..2f30ef67fe4 100644 --- a/xlators/cluster/dht/src/tier-common.c +++ b/xlators/cluster/dht/src/tier-common.c @@ -235,8 +235,10 @@ tier_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  dht_linkfile_attr_heal (frame, this);          }  out: -        if (local->xattr_req) { -                dict_del (local->xattr_req, TIER_LINKFILE_GFID); +        if (local) { +                if (local->xattr_req) { +                        dict_del (local->xattr_req, TIER_LINKFILE_GFID); +                }          }          DHT_STRIP_PHASE1_FLAGS (stbuf); @@ -766,25 +768,17 @@ tier_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                   int op_ret, int op_errno, gf_dirent_t *orig_entries,                   dict_t *xdata)  { -        dht_local_t  *local = NULL;          gf_dirent_t   entries;          gf_dirent_t  *orig_entry = NULL;          gf_dirent_t  *entry = NULL; -        xlator_t     *prev = NULL; -        xlator_t     *next_subvol = NULL; -        off_t         next_offset = 0;          int           count = 0;          INIT_LIST_HEAD (&entries.list); -        prev = cookie; -        local = frame->local;          if (op_ret < 0) -                goto done; +                goto unwind;          list_for_each_entry (orig_entry, (&orig_entries->list), list) { -                next_offset = orig_entry->d_off; -                  entry = gf_dirent_for_name (orig_entry->d_name);                  if (!entry) {                          gf_msg (this->name, GF_LOG_ERROR, ENOMEM, @@ -803,23 +797,6 @@ tier_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          }          op_ret = count; -done: -        if (count == 0) { -                /* non-zero next_offset means that -                   EOF is not yet hit on the current subvol -                */ -                if (next_offset != 0) { -                        next_subvol = prev; -                } else { -                        goto unwind; -                } - -                STACK_WIND_COOKIE (frame, tier_readdir_cbk, next_subvol, -                                   next_subvol, next_subvol->fops->readdir, -                                   local->fd, local->size, next_offset, NULL); -                return 0; -        } -  unwind:          if (op_ret < 0)                  op_ret = 0;  | 
