Commit 14fa0856 authored by Chengguang Xu's avatar Chengguang Xu Committed by Miklos Szeredi
Browse files

ovl: using posix_acl_xattr_size() to get size instead of posix_acl_to_xattr()



There is no functional change but it seems better to get size by calling
posix_acl_xattr_size() instead of calling posix_acl_to_xattr() with
NULL buffer argument. Additionally, remove unnecessary assignments.

Signed-off-by: default avatarChengguang Xu <cgxu519@gmx.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 1e92e307
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -414,13 +414,12 @@ static int ovl_set_upper_acl(struct dentry *upperdentry, const char *name,
	if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !acl)
	if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !acl)
		return 0;
		return 0;


	size = posix_acl_to_xattr(NULL, acl, NULL, 0);
	size = posix_acl_xattr_size(acl->a_count);
	buffer = kmalloc(size, GFP_KERNEL);
	buffer = kmalloc(size, GFP_KERNEL);
	if (!buffer)
	if (!buffer)
		return -ENOMEM;
		return -ENOMEM;


	size = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
	err = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
	err = size;
	if (err < 0)
	if (err < 0)
		goto out_free;
		goto out_free;