Skip to content

Commit

Permalink
Simplify check in zpl_permission()
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Walker <awalker@ixsystems.com>
  • Loading branch information
anodos325 committed May 19, 2021
1 parent 01cde40 commit d86fc0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion module/os/linux/zfs/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ secpolicy_vnode_access2(const cred_t *cr, struct inode *ip, uid_t owner,
mode_t curmode, mode_t wantmode)
{
mode_t remainder = ~curmode & wantmode;
if (!(ITOZSB(ip)->z_acl_type == ZFS_ACLTYPE_NFSV4) ||
if ((ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_NFSV4) ||
(remainder == 0)) {
return (0);
}
Expand Down
4 changes: 2 additions & 2 deletions module/os/linux/zfs/zpl_xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static const struct {
#endif
};

#define GENERIC_MASK(mask) ((mask & ~(MAY_READ | MAY_WRITE | MAY_EXEC)) != 0)
#define GENERIC_MASK(mask) ((mask & ~(MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)

static int
zpl_xattr_permission(xattr_filldir_t *xf, const char *name, int name_len)
Expand Down Expand Up @@ -1411,7 +1411,7 @@ zpl_permission(struct inode *ip, int mask)
cr = CRED();
crhold(cr);
ret = -zfs_access(ITOZ(ip), to_check, V_ACE_MASK, cr);
if (!((ret == -EPERM) || (ret == -EACCES))) {
if (ret != -EPERM && ret != -EACCES) {
crfree(cr);
return (ret);
}
Expand Down

0 comments on commit d86fc0e

Please sign in to comment.