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>
This commit is contained in:
parent
e79e0e1428
commit
910f3d58d0
|
@ -82,14 +82,12 @@ struct posix_acl *gfs2_get_acl(struct inode *inode, int type)
|
||||||
int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
int len;
|
size_t len;
|
||||||
char *data;
|
char *data;
|
||||||
const char *name = gfs2_acl_name(type);
|
const char *name = gfs2_acl_name(type);
|
||||||
|
|
||||||
if (acl) {
|
if (acl) {
|
||||||
len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0);
|
len = posix_acl_xattr_size(acl->a_count);
|
||||||
if (len == 0)
|
|
||||||
return 0;
|
|
||||||
data = kmalloc(len, GFP_NOFS);
|
data = kmalloc(len, GFP_NOFS);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
Loading…
Reference in New Issue