Fix coverity defects: CID 147503

CID 147503: Dereference after null check (FORWARD_NULL)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn>
Closes #5326
This commit is contained in:
luozhengzheng 2016-11-11 00:50:32 +08:00 committed by Brian Behlendorf
parent 3bfd95d589
commit 32dec7bd1a

View File

@ -1313,6 +1313,9 @@ zfs_create(struct inode *dip, char *name, vattr_t *vap, int excl,
(vsecp || IS_EPHEMERAL(uid) || IS_EPHEMERAL(gid))) (vsecp || IS_EPHEMERAL(uid) || IS_EPHEMERAL(gid)))
return (SET_ERROR(EINVAL)); return (SET_ERROR(EINVAL));
if (name == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp); ZFS_VERIFY_ZP(dzp);
os = zsb->z_os; os = zsb->z_os;
@ -1667,6 +1670,9 @@ zfs_remove(struct inode *dip, char *name, cred_t *cr, int flags)
int zflg = ZEXISTS; int zflg = ZEXISTS;
boolean_t waited = B_FALSE; boolean_t waited = B_FALSE;
if (name == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp); ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log; 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))) (vsecp || IS_EPHEMERAL(uid) || IS_EPHEMERAL(gid)))
return (SET_ERROR(EINVAL)); return (SET_ERROR(EINVAL));
if (dirname == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp); ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log; zilog = zsb->z_log;
@ -2080,6 +2089,9 @@ zfs_rmdir(struct inode *dip, char *name, struct inode *cwd, cred_t *cr,
int zflg = ZEXISTS; int zflg = ZEXISTS;
boolean_t waited = B_FALSE; boolean_t waited = B_FALSE;
if (name == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp); ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log; zilog = zsb->z_log;
@ -3382,6 +3394,9 @@ zfs_rename(struct inode *sdip, char *snm, struct inode *tdip, char *tnm,
int zflg = 0; int zflg = 0;
boolean_t waited = B_FALSE; boolean_t waited = B_FALSE;
if (snm == NULL || tnm == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(sdzp); ZFS_VERIFY_ZP(sdzp);
zilog = zsb->z_log; 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)); ASSERT(S_ISLNK(vap->va_mode));
if (name == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp); ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log; zilog = zsb->z_log;
@ -3926,6 +3944,9 @@ zfs_link(struct inode *tdip, struct inode *sip, char *name, cred_t *cr,
#endif #endif
ASSERT(S_ISDIR(tdip->i_mode)); ASSERT(S_ISDIR(tdip->i_mode));
if (name == NULL)
return (SET_ERROR(EINVAL));
ZFS_ENTER(zsb); ZFS_ENTER(zsb);
ZFS_VERIFY_ZP(dzp); ZFS_VERIFY_ZP(dzp);
zilog = zsb->z_log; zilog = zsb->z_log;