Commit ed02d13f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: only allocate the buffer size actually needed in __xfs_set_acl

No need to allocate the max size if we can just allocate the easily
known actual ACL size.
Suggested-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent f311d771
......@@ -191,16 +191,11 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
args.namelen = strlen(args.name);
if (acl) {
args.valuelen = XFS_ACL_MAX_SIZE(ip->i_mount);
args.valuelen = XFS_ACL_SIZE(acl->a_count);
args.value = kmem_zalloc_large(args.valuelen, 0);
if (!args.value)
return -ENOMEM;
xfs_acl_to_disk(args.value, acl);
/* subtract away the unused acl entries */
args.valuelen -= sizeof(struct xfs_acl_entry) *
(XFS_ACL_MAX_ENTRIES(ip->i_mount) - acl->a_count);
}
error = xfs_attr_set(&args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment