OSDN Git Service

xfs: clean up bufsize alignment in xfs_ioc_attr_list
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Feb 2020 01:30:44 +0000 (17:30 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 3 Mar 2020 04:55:55 +0000 (20:55 -0800)
Use the round_down macro, and use the size of the uint32 type we
use in the callback that fills the buffer to make the code a little
more clear - the size of it is always the same as int for platforms
that Linux runs on.

Suggested-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_ioctl.c

index 2af73d6..ef8e378 100644 (file)
@@ -415,7 +415,7 @@ xfs_ioc_attr_list(
        context.resynch = 1;
        context.attr_filter = xfs_attr_filter(flags);
        context.buffer = buffer;
-       context.bufsize = (bufsize & ~(sizeof(int)-1));  /* align */
+       context.bufsize = round_down(bufsize, sizeof(uint32_t));
        context.firstu = context.bufsize;
        context.put_listent = xfs_ioc_attr_put_listent;