diff options
| author | Sunny Kumar <sunkumar@redhat.com> | 2018-10-30 20:22:41 +0530 | 
|---|---|---|
| committer | Amar Tumballi <amarts@redhat.com> | 2018-11-03 05:30:41 +0000 | 
| commit | 91cb12be96fb543ee9c0b47bfa8792786286aff7 (patch) | |
| tree | c07fb2d35a62538fb986852d95d8e6d9e893ccc0 | |
| parent | a665120d77072cfc8daca88d717055132a178be1 (diff) | |
posix : fix coverity issues in posix-entry-ops.c
This patch fixes CID:
 1. 1389762 : Explicit null dereferenced
 2. 1390462 : Argument cannot be negative
 3. 1124552 : Explicit null dereferenced
 4. 1356522 : Argument cannot be negative
updates: bz#789278
Change-Id: I1262f3b4b61a6e65bb34884f46df9a24b8dd03f1
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
| -rw-r--r-- | xlators/storage/posix/src/posix-entry-ops.c | 16 | 
1 files changed, 14 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c index 1888de7db9b..ca5b8b1d4bf 100644 --- a/xlators/storage/posix/src/posix-entry-ops.c +++ b/xlators/storage/posix/src/posix-entry-ops.c @@ -211,7 +211,11 @@ posix_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)          MAKE_INODE_HANDLE(real_path, this, loc, &buf);      } else {          MAKE_ENTRY_HANDLE(real_path, par_path, this, loc, &buf); - +        if (!real_path || !par_path) { +            op_ret = -1; +            op_errno = ESTALE; +            goto out; +        }          if (gf_uuid_is_null(loc->inode->gfid)) {              op_ret = posix_gfid_heal(this, real_path, loc, xdata);              if (op_ret < 0) { @@ -787,6 +791,8 @@ posix_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,                  }                  op_errno = dict_set_int8(xdata_rsp, GF_PREOP_CHECK_FAILED, 1); +                if (op_errno < 0) +                    op_errno = errno;                  goto out;              } @@ -1223,7 +1229,7 @@ posix_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,      unwind_dict = dict_new();      if (!unwind_dict) { -        op_errno = -ENOMEM; +        op_errno = ENOMEM;          op_ret = -1;          goto out;      } @@ -2255,6 +2261,12 @@ posix_put(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,      MAKE_ENTRY_HANDLE(real_path, par_path, this, loc, &stbuf); +    if (!real_path || !par_path) { +        op_ret = -1; +        op_errno = ESTALE; +        goto out; +    } +      op_ret = posix_pstat(this, loc->parent, loc->pargfid, par_path, &preparent,                           _gf_false);      if (op_ret < 0) {  | 
