public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: don't overflow quota ID when initializing dqblk
Date: Sat, 23 Jan 2016 08:13:20 -0500	[thread overview]
Message-ID: <20160123131318.GA2795@bfoster.bfoster> (raw)
In-Reply-To: <56A01BB4.1050409@redhat.com>

On Wed, Jan 20, 2016 at 05:43:48PM -0600, Eric Sandeen wrote:
> Quota IDs are unsigned, and so we can pass in values up
> to 2^32-1.  But if we try to initialize a block containing
> values over MAX_INT, curid will overflow and assert.
> 
> curid holds a quota ID, so give it the proper
> xfs_dqid_t type (and remove the now-impossible ASSERT).
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

> 
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 83ce4aa..5d92bb5 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -232,7 +232,8 @@ xfs_qm_init_dquot_blk(
>  {
>  	struct xfs_quotainfo	*q = mp->m_quotainfo;
>  	xfs_dqblk_t	*d;
> -	int		curid, i;
> +	xfs_dqid_t	curid;
> +	int		i;
>  
>  	ASSERT(tp);
>  	ASSERT(xfs_buf_islocked(bp));
> @@ -243,7 +244,6 @@ xfs_qm_init_dquot_blk(
>  	 * ID of the first dquot in the block - id's are zero based.
>  	 */
>  	curid = id - (id % q->qi_dqperchunk);
> -	ASSERT(curid >= 0);
>  	memset(d, 0, BBTOB(q->qi_dqchunklen));
>  	for (i = 0; i < q->qi_dqperchunk; i++, d++, curid++) {
>  		d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2016-01-23 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 23:43 [PATCH] xfs: don't overflow quota ID when initializing dqblk Eric Sandeen
2016-01-23 13:13 ` Brian Foster [this message]

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=20160123131318.GA2795@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox