summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-inode-fd-ops.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-08-28 00:01:26 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-31 01:26:06 +0000
commitd3b1456c52f7dc4f21cdae2855092fda6b96af4a (patch)
tree3ccc6d7cac5c93bfcc3d67fdfd1effa853e13735 /xlators/storage/posix/src/posix-inode-fd-ops.c
parent6a2f83caad7ff882e3a8da5fdec4be8ceccbfdc2 (diff)
clang-scan: fix multiple issues
* Buffer overflow issue in glusterfsd * Null argument passed to function expecting non-null (event-epoll) * Make sure the op_ret value is set in macro (posix) Updates: bz#1622665 Change-Id: I32b378fc40a5e3ee800c0dfbc13335d44c9db9ac Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-inode-fd-ops.c')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 795f19a1515..64fa5ea7a82 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -1257,13 +1257,14 @@ posix_readlink (call_frame_t *frame, xlator_t *this,
{
char * dest = NULL;
int32_t op_ret = -1;
- int32_t op_errno = 0;
+ int32_t op_errno = EINVAL;
char * real_path = NULL;
struct iatt stbuf = {0,};
DECLARE_OLD_FS_ID_VAR;
VALIDATE_OR_GOTO (frame, out);
+ VALIDATE_OR_GOTO (loc, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
@@ -3993,12 +3994,15 @@ int32_t
posix_removexattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, const char *name, dict_t *xdata)
{
- int op_ret = 0;
- int op_errno = 0;
+ int op_ret = -1;
+ int op_errno = EINVAL;
dict_t *xdata_rsp = NULL;
+ VALIDATE_OR_GOTO (loc, out);
+
op_ret = posix_common_removexattr (frame, loc, NULL, name, xdata,
&op_errno, &xdata_rsp);
+out:
STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata_rsp);
if (xdata_rsp)
@@ -4011,12 +4015,15 @@ int32_t
posix_fremovexattr (call_frame_t *frame, xlator_t *this,
fd_t *fd, const char *name, dict_t *xdata)
{
- int32_t op_ret = 0;
- int32_t op_errno = 0;
+ int32_t op_ret = -1;
+ int32_t op_errno = EINVAL;
dict_t *xdata_rsp = NULL;
+ VALIDATE_OR_GOTO (fd, out);
+
op_ret = posix_common_removexattr (frame, NULL, fd, name, xdata,
&op_errno, &xdata_rsp);
+out:
STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata_rsp);
if (xdata_rsp)