Re: [PATCH 30/30] xfs: clean up bufsize alignment in xfs_ioc_attr_list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 25, 2020 at 03:10:12PM -0800, Christoph Hellwig wrote:
> 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@xxxxxxxxxx>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/xfs/xfs_ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 58fd2d219972..c805fdf4ea39 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -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;

Much nicer.

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux