From: Chengguang Xu Date: Fri, 22 Jun 2018 01:49:36 +0000 (+0800) Subject: ovl: using posix_acl_xattr_size() to get size instead of posix_acl_to_xattr() X-Git-Tag: v4.20-rc1~30^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14fa085640a7eb55431eec8a0273bbf0c463ce46;p=thirdparty%2Fkernel%2Flinux.git 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: Chengguang Xu Signed-off-by: Miklos Szeredi --- diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index e03f39550ccf0..ce1857fb54348 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -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;