All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: Dave Chinner <dchinner@redhat.com>,
	"Darrick J . Wong" <darrick.wong@oracle.com>
Subject: [PATCH 30/32] xfs: clean up bufsize alignment in xfs_ioc_attr_list
Date: Wed, 26 Feb 2020 12:23:04 -0800	[thread overview]
Message-ID: <20200226202306.871241-31-hch@lst.de> (raw)
In-Reply-To: <20200226202306.871241-1-hch@lst.de>

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>
---
 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;
 
-- 
2.24.1


  parent reply	other threads:[~2020-02-26 20:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 20:22 clean up the attr interface v7 Christoph Hellwig
2020-02-26 20:22 ` [PATCH 01/32] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE Christoph Hellwig
2020-02-26 20:22 ` [PATCH 02/32] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
2020-02-26 20:22 ` [PATCH 03/32] xfs: merge xfs_attr_remove into xfs_attr_set Christoph Hellwig
2020-02-26 20:22 ` [PATCH 04/32] xfs: merge xfs_attrmulti_attr_remove into xfs_attrmulti_attr_set Christoph Hellwig
2020-02-26 20:22 ` [PATCH 05/32] xfs: use strndup_user in XFS_IOC_ATTRMULTI_BY_HANDLE Christoph Hellwig
2020-02-26 20:22 ` [PATCH 06/32] xfs: factor out a helper for a single XFS_IOC_ATTRMULTI_BY_HANDLE op Christoph Hellwig
2020-02-26 20:22 ` [PATCH 07/32] xfs: remove the name == NULL check from xfs_attr_args_init Christoph Hellwig
2020-02-26 20:22 ` [PATCH 08/32] xfs: remove the MAXNAMELEN " Christoph Hellwig
2020-02-26 20:22 ` [PATCH 09/32] xfs: turn xfs_da_args.value into a void pointer Christoph Hellwig
2020-02-26 20:22 ` [PATCH 10/32] xfs: pass an initialized xfs_da_args structure to xfs_attr_set Christoph Hellwig
2020-02-26 20:22 ` [PATCH 11/32] xfs: pass an initialized xfs_da_args to xfs_attr_get Christoph Hellwig
2020-02-26 20:22 ` [PATCH 12/32] xfs: remove the xfs_inode argument to xfs_attr_get_ilocked Christoph Hellwig
2020-02-26 20:22 ` [PATCH 13/32] xfs: remove ATTR_KERNOVAL Christoph Hellwig
2020-02-26 20:22 ` [PATCH 14/32] xfs: remove ATTR_ALLOC and XFS_DA_OP_ALLOCVAL Christoph Hellwig
2020-02-26 20:22 ` [PATCH 15/32] xfs: replace ATTR_KERNOTIME with XFS_DA_OP_NOTIME Christoph Hellwig
2020-02-26 20:22 ` [PATCH 16/32] xfs: factor out a xfs_attr_match helper Christoph Hellwig
2020-02-26 20:22 ` [PATCH 17/32] xfs: cleanup struct xfs_attr_list_context Christoph Hellwig
2020-02-26 20:22 ` [PATCH 18/32] xfs: remove the unused ATTR_ENTRY macro Christoph Hellwig
2020-02-26 20:22 ` [PATCH 19/32] xfs: open code ATTR_ENTSIZE Christoph Hellwig
2020-02-26 20:22 ` [PATCH 20/32] xfs: move the legacy xfs_attr_list to xfs_ioctl.c Christoph Hellwig
2020-02-26 20:22 ` [PATCH 21/32] xfs: rename xfs_attr_list_int to xfs_attr_list Christoph Hellwig
2020-02-26 20:22 ` [PATCH 22/32] xfs: lift common checks into xfs_ioc_attr_list Christoph Hellwig
2020-02-26 20:22 ` [PATCH 23/32] xfs: lift buffer allocation " Christoph Hellwig
2020-02-26 20:22 ` [PATCH 24/32] xfs: lift cursor copy in/out " Christoph Hellwig
2020-02-26 20:22 ` [PATCH 25/32] xfs: improve xfs_forget_acl Christoph Hellwig
2020-02-26 20:23 ` [PATCH 26/32] xfs: clean up the ATTR_REPLACE checks Christoph Hellwig
2020-02-26 20:23 ` [PATCH 27/32] xfs: clean up the attr flag confusion Christoph Hellwig
2020-02-26 20:23 ` [PATCH 28/32] xfs: remove XFS_DA_OP_INCOMPLETE Christoph Hellwig
2020-02-26 20:23 ` [PATCH 29/32] xfs: embedded the attrlist cursor into struct xfs_attr_list_context Christoph Hellwig
2020-02-26 20:23 ` Christoph Hellwig [this message]
2020-02-26 20:23 ` [PATCH 31/32] xfs: only allocate the buffer size actually needed in __xfs_set_acl Christoph Hellwig
2020-02-26 20:37   ` Darrick J. Wong
2020-02-26 21:35   ` Dave Chinner
2020-02-26 20:23 ` [PATCH 32/32] xfs: switch xfs_attrmulti_attr_get to lazy attr buffer allocation Christoph Hellwig
2020-02-26 20:33   ` Darrick J. Wong
2020-02-26 21:40   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200226202306.871241-31-hch@lst.de \
    --to=hch@lst.de \
    --cc=darrick.wong@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.