Message ID | 20240816063849.1989856-1-lihongbo22@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [-next] fs: Use in_group_or_capable() helper to simplify the code | expand |
On Fri, 16 Aug 2024 14:38:49 +0800, Hongbo Li wrote: > Since in_group_or_capable has been exported, we can use > it to simplify the code when check group and capable. > > Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.misc branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.misc [1/1] fs: Use in_group_or_capable() helper to simplify the code https://git.kernel.org/vfs/vfs/c/b882a0608243
On Fri 16-08-24 14:38:49, Hongbo Li wrote: > Since in_group_or_capable has been exported, we can use > it to simplify the code when check group and capable. > > Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/posix_acl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/posix_acl.c b/fs/posix_acl.c > index 3f87297dbfdb..6c66a37522d0 100644 > --- a/fs/posix_acl.c > +++ b/fs/posix_acl.c > @@ -715,8 +715,8 @@ int posix_acl_update_mode(struct mnt_idmap *idmap, > return error; > if (error == 0) > *acl = NULL; > - if (!vfsgid_in_group_p(i_gid_into_vfsgid(idmap, inode)) && > - !capable_wrt_inode_uidgid(idmap, inode, CAP_FSETID)) > + if (!in_group_or_capable(idmap, inode, > + i_gid_into_vfsgid(idmap, inode))) > mode &= ~S_ISGID; > *mode_p = mode; > return 0; > -- > 2.34.1 >
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 3f87297dbfdb..6c66a37522d0 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -715,8 +715,8 @@ int posix_acl_update_mode(struct mnt_idmap *idmap, return error; if (error == 0) *acl = NULL; - if (!vfsgid_in_group_p(i_gid_into_vfsgid(idmap, inode)) && - !capable_wrt_inode_uidgid(idmap, inode, CAP_FSETID)) + if (!in_group_or_capable(idmap, inode, + i_gid_into_vfsgid(idmap, inode))) mode &= ~S_ISGID; *mode_p = mode; return 0;
Since in_group_or_capable has been exported, we can use it to simplify the code when check group and capable. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> --- fs/posix_acl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)