summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_vnops.c
diff options
context:
space:
mode:
authorBearBabyLiu <[email protected]>2016-09-21 10:09:22 +0800
committerBrian Behlendorf <[email protected]>2016-09-20 19:09:22 -0700
commit609603a5d3356c2c69c926038eee6755e0183d27 (patch)
treecd67d4a103194151e15e9939070aa97e72842a77 /module/zfs/zfs_vnops.c
parent9911a9c4c9501112dcb2a64a5195820068676e62 (diff)
Fix coverity defects
coverity scan CID:147504 Type: Explicit null dereferenced Reason: passing null pointer dl to zfs_dirent_unlock Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: BearBabyLiu <[email protected]> Closes #5131
Diffstat (limited to 'module/zfs/zfs_vnops.c')
-rw-r--r--module/zfs/zfs_vnops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 405b37c19..796cd1e34 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -1470,8 +1470,10 @@ top:
if (S_ISREG(ZTOI(zp)->i_mode) &&
(vap->va_mask & ATTR_SIZE) && (vap->va_size == 0)) {
/* we can't hold any locks when calling zfs_freesp() */
- zfs_dirent_unlock(dl);
- dl = NULL;
+ if (dl) {
+ zfs_dirent_unlock(dl);
+ dl = NULL;
+ }
error = zfs_freesp(zp, 0, 0, mode, TRUE);
}
}