diff options
author | Richard Yao <[email protected]> | 2022-11-10 09:09:35 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-11-10 13:58:05 -0800 |
commit | b1eec00904a22bd6600a2853709ca50faa56ea24 (patch) | |
tree | 5b802a2ad7252d73192b68740f1fdf1925663d0a | |
parent | 9e2be2dfbde6c41ff53d71f3669cb6b9909c5a40 (diff) |
Cleanup: Suppress Coverity dereference before/after NULL check reports
f224eddf922a33ca4b86d83148e9e6fa155fc290 began dereferencing a NULL
checked pointer in zpl_vap_init(), which made Coverity complain because
either the dereference is unsafe or the NULL check is unnecessary. Upon
inspection, this pointer is guaranteed to never be NULL because it is
from the Linux kernel VFS. The calls into ZFS simply would not make
sense if this pointer were NULL, so the NULL check is unnecessary.
Reported-by: Coverity (CID 1527260)
Reported-by: Coverity (CID 1527262)
Reviewed-by: Mariusz Zaborski <[email protected]>
Reviewed-by: Youzhong Yang <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14170
-rw-r--r-- | module/os/linux/zfs/zpl_inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c index 6f4718f7d..93eae7201 100644 --- a/module/os/linux/zfs/zpl_inode.c +++ b/module/os/linux/zfs/zpl_inode.c @@ -121,7 +121,7 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr, vap->va_uid = zfs_vfsuid_to_uid((struct user_namespace *)mnt_ns, zfs_i_user_ns(dir), crgetuid(cr)); - if (dir && dir->i_mode & S_ISGID) { + if (dir->i_mode & S_ISGID) { vap->va_gid = KGID_TO_SGID(dir->i_gid); if (S_ISDIR(mode)) vap->va_mode |= S_ISGID; |