summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2018-09-18 17:09:28 +0530
committerAmar Tumballi <amarts@redhat.com>2018-09-20 14:09:41 +0000
commit65bd1e2f94781bea5ad6eeb5b4d9f9f614660085 (patch)
treed00b13db4ffb1589a6a4af80609b89f305b1aa4e /xlators/storage/posix
parent5784a00f997212d34bd52b2303e20c097240d91c (diff)
storage/posix: Check if fd->inode is NULL before using it
CID: 1395473, 1395472 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=85588219&defectInstanceId=26115956&mergedDefectId=1395472 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=85588219&defectInstanceId=26115961&mergedDefectId=1395473 Change-Id: I2c3cc350e0ac156616df6f568ba28dbfa68064bf updates: bz#789278 Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 2cb65d7fd0e..4b6716fcd7f 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -1522,13 +1522,13 @@ posix_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
VALIDATE_OR_GOTO(frame, out);
VALIDATE_OR_GOTO(this, out);
VALIDATE_OR_GOTO(fd, out);
+ VALIDATE_OR_GOTO(fd->inode, out);
VALIDATE_OR_GOTO(this->private, out);
priv = this->private;
VALIDATE_OR_GOTO(priv, out);
- if (fd->inode && ((fd->inode->ia_type == IA_IFBLK) ||
- (fd->inode->ia_type == IA_IFCHR))) {
+ if ((fd->inode->ia_type == IA_IFBLK) || (fd->inode->ia_type == IA_IFCHR)) {
gf_msg(this->name, GF_LOG_ERROR, EINVAL, P_MSG_INVALID_ARGUMENT,
"readv received on a block/char file (%s)",
uuid_utoa(fd->inode->gfid));
@@ -1798,6 +1798,7 @@ posix_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO(frame, out);
VALIDATE_OR_GOTO(this, out);
VALIDATE_OR_GOTO(fd, out);
+ VALIDATE_OR_GOTO(fd->inode, out);
VALIDATE_OR_GOTO(vector, out);
VALIDATE_OR_GOTO(this->private, out);
@@ -1806,8 +1807,7 @@ posix_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO(priv, out);
DISK_SPACE_CHECK_AND_GOTO(frame, priv, xdata, op_ret, op_errno, out);
- if (fd->inode && ((fd->inode->ia_type == IA_IFBLK) ||
- (fd->inode->ia_type == IA_IFCHR))) {
+ if ((fd->inode->ia_type == IA_IFBLK) || (fd->inode->ia_type == IA_IFCHR)) {
gf_msg(this->name, GF_LOG_ERROR, EINVAL, P_MSG_INVALID_ARGUMENT,
"writev received on a block/char file (%s)",
uuid_utoa(fd->inode->gfid));