Skip to content

Commit

Permalink
Linux: zfs_zaccess_trivial() should always call generic_permission()
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Reviewed-by: Youzhong Yang <yyang@mathworks.com>
Signed-off-by: Richard Yao <richard.yao@klarasystems.com>
Closes openzfs#14738
  • Loading branch information
Richard Yao authored and andrewc12 committed May 1, 2023
1 parent ff4ac28 commit fd758cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions module/os/linux/zfs/zfs_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd758cb

Please sign in to comment.