Skip to content

Commit

Permalink
ovl: using posix_acl_xattr_size() to get size instead of posix_acl_to…
Browse files Browse the repository at this point in the history
…_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: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Chengguang Xu authored and Miklos Szeredi committed Oct 26, 2018
1 parent 1e92e30 commit 14fa085
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/overlayfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,12 @@ static int ovl_set_upper_acl(struct dentry *upperdentry, const char *name,
if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !acl)
return 0;

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

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

Expand Down

0 comments on commit 14fa085

Please sign in to comment.