summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_ioctl.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-02-26 17:30:43 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-03-02 20:55:55 -0800
commite3a19cdea84a42d44ef42ff8b5459c903992bbf2 (patch)
treebc1607feb69098bd4b1d4cbd09f2a3f75c056ab6 /fs/xfs/xfs_ioctl.c
parent254f800f810415cce05872c88e9ef797d81f4375 (diff)
xfs: embedded the attrlist cursor into struct xfs_attr_list_context
The attrlist cursor only exists as part of an attr list context, so embedd the structure instead of pointing to it. Also give it a proper xfs_ prefix and remove the obsolete typedef. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_ioctl.c')
-rw-r--r--fs/xfs/xfs_ioctl.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 9ddaa3cf9bf4..2af73d664613 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -375,8 +375,7 @@ xfs_ioc_attr_list(
int flags,
struct xfs_attrlist_cursor __user *ucursor)
{
- struct xfs_attr_list_context context;
- struct attrlist_cursor_kern cursor;
+ struct xfs_attr_list_context context = { };
struct xfs_attrlist *alist;
void *buffer;
int error;
@@ -396,12 +395,13 @@ xfs_ioc_attr_list(
/*
* Validate the cursor.
*/
- if (copy_from_user(&cursor, ucursor, sizeof(cursor)))
+ if (copy_from_user(&context.cursor, ucursor, sizeof(context.cursor)))
return -EFAULT;
- if (cursor.pad1 || cursor.pad2)
+ if (context.cursor.pad1 || context.cursor.pad2)
return -EINVAL;
- if ((cursor.initted == 0) &&
- (cursor.hashval || cursor.blkno || cursor.offset))
+ if (!context.cursor.initted &&
+ (context.cursor.hashval || context.cursor.blkno ||
+ context.cursor.offset))
return -EINVAL;
buffer = kmem_zalloc_large(bufsize, 0);
@@ -411,9 +411,7 @@ xfs_ioc_attr_list(
/*
* Initialize the output buffer.
*/
- memset(&context, 0, sizeof(context));
context.dp = dp;
- context.cursor = &cursor;
context.resynch = 1;
context.attr_filter = xfs_attr_filter(flags);
context.buffer = buffer;
@@ -431,7 +429,7 @@ xfs_ioc_attr_list(
goto out_free;
if (copy_to_user(ubuf, buffer, bufsize) ||
- copy_to_user(ucursor, &cursor, sizeof(cursor)))
+ copy_to_user(ucursor, &context.cursor, sizeof(context.cursor)))
error = -EFAULT;
out_free:
kmem_free(buffer);