diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-06-21 21:51:43 -0400 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2018-07-24 14:02:11 -0400 |
commit | 910f3d58d0d40691534b77cc01588ffa22ee7dee (patch) | |
tree | 21b091811e336ceea65f51f690eef4a1361a3de2 | |
parent | e79e0e1428188b24c3b57309ffa54a33c4ae40c4 (diff) |
gfs2: using posix_acl_xattr_size instead of posix_acl_to_xattr
It seems better to get size by calling posix_acl_xattr_size() instead of
calling posix_acl_to_xattr() with NULL buffer argument.
posix_acl_xattr_size() never returns 0, so remove the unnecessary check.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r-- | fs/gfs2/acl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index 776717f1eeea..af5f87a493d9 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c | |||
@@ -82,14 +82,12 @@ struct posix_acl *gfs2_get_acl(struct inode *inode, int type) | |||
82 | int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) | 82 | int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
83 | { | 83 | { |
84 | int error; | 84 | int error; |
85 | int len; | 85 | size_t len; |
86 | char *data; | 86 | char *data; |
87 | const char *name = gfs2_acl_name(type); | 87 | const char *name = gfs2_acl_name(type); |
88 | 88 | ||
89 | if (acl) { | 89 | if (acl) { |
90 | len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0); | 90 | len = posix_acl_xattr_size(acl->a_count); |
91 | if (len == 0) | ||
92 | return 0; | ||
93 | data = kmalloc(len, GFP_NOFS); | 91 | data = kmalloc(len, GFP_NOFS); |
94 | if (data == NULL) | 92 | if (data == NULL) |
95 | return -ENOMEM; | 93 | return -ENOMEM; |