]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ovl: using posix_acl_xattr_size() to get size instead of posix_acl_to_xattr()
authorChengguang Xu <cgxu519@gmx.com>
Fri, 22 Jun 2018 01:49:36 +0000 (09:49 +0800)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 26 Oct 2018 21:34:40 +0000 (23:34 +0200)
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>
fs/overlayfs/dir.c

index e03f39550ccf0c8caeae0006d0bdddf7f79a01c8..ce1857fb54348ef83b810b3f9fa143cbb923cfd3 100644 (file)
@@ -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;