summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluozhengzheng <[email protected]>2016-11-11 00:50:32 +0800
committerBrian Behlendorf <[email protected]>2016-11-10 08:50:32 -0800
commit32dec7bd1a0bce6039a65768ed8552164a0130bf (patch)
tree3f13485a7040cf45ca97d0f4bff1fa5cc6d5b1ce
parent3bfd95d5898b1318f9a5c36d1cc43cf23d004f64 (diff)
Fix coverity defects: CID 147503
CID 147503: Dereference after null check (FORWARD_NULL) Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: luozhengzheng <[email protected]> Closes #5326
-rw-r--r--module/zfs/zfs_vnops.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 4a0f20166..7601e7618 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -1313,6 +1313,9 @@ zfs_create(struct inode *dip, char *name, vattr_t *vap, int excl,
(vsecp || IS_EPHEMERAL(uid) || IS_EPHEMERAL(gid)))
return (SET_ERROR(EINVAL));
+ if (name == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp);
os = zsb->z_os;
@@ -1667,6 +1670,9 @@ zfs_remove(struct inode *dip, char *name, cred_t *cr, int flags)
int zflg = ZEXISTS;
boolean_t waited = B_FALSE;
+ if (name == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log;
@@ -1918,6 +1924,9 @@ zfs_mkdir(struct inode *dip, char *dirname, vattr_t *vap, struct inode **ipp,
(vsecp || IS_EPHEMERAL(uid) || IS_EPHEMERAL(gid)))
return (SET_ERROR(EINVAL));
+ if (dirname == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log;
@@ -2080,6 +2089,9 @@ zfs_rmdir(struct inode *dip, char *name, struct inode *cwd, cred_t *cr,
int zflg = ZEXISTS;
boolean_t waited = B_FALSE;
+ if (name == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log;
@@ -3382,6 +3394,9 @@ zfs_rename(struct inode *sdip, char *snm, struct inode *tdip, char *tnm,
int zflg = 0;
boolean_t waited = B_FALSE;
+ if (snm == NULL || tnm == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(sdzp);
zilog = zsb->z_log;
@@ -3726,6 +3741,9 @@ zfs_symlink(struct inode *dip, char *name, vattr_t *vap, char *link,
ASSERT(S_ISLNK(vap->va_mode));
+ if (name == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log;
@@ -3926,6 +3944,9 @@ zfs_link(struct inode *tdip, struct inode *sip, char *name, cred_t *cr,
#endif
ASSERT(S_ISDIR(tdip->i_mode));
+ if (name == NULL)
+ return (SET_ERROR(EINVAL));
+
ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log;