From ab71b24d20df7ec59c6b3a2b560af263ad262d9b Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Tue, 11 Apr 2023 17:50:43 +0000 Subject: [PATCH] Linux: zfs_zaccess_trivial() should always call generic_permission() Building with Clang on Linux generates a warning that err could be uninitialized if mnt_ns is a NULL pointer. However, mnt_ns should never be NULL, so there is no need to put this behind an if statement. Taking it outside of the if statement means that the possibility of err being uninitialized goes from being always zero in a way that the compiler could not realize to a way that is always zero in a way that the compiler can realize. Sponsored-By: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf Reviewed-by: Youzhong Yang Signed-off-by: Richard Yao Closes #14738 --- module/os/linux/zfs/zfs_acl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c index df4ebc387..ff26f47f2 100644 --- a/module/os/linux/zfs/zfs_acl.c +++ b/module/os/linux/zfs/zfs_acl.c @@ -2466,8 +2466,7 @@ zfs_zaccess_trivial(znode_t *zp, uint32_t *working_mode, cred_t *cr, #if (defined(HAVE_IOPS_PERMISSION_USERNS) || \ defined(HAVE_IOPS_PERMISSION_IDMAP)) - if (mnt_ns) - err = generic_permission(mnt_ns, ZTOI(zp), mask); + err = generic_permission(mnt_ns, ZTOI(zp), mask); #else err = generic_permission(ZTOI(zp), mask); #endif