linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: calculate correct offset in xfs_scrub_quota_item
Date: Mon, 27 Nov 2017 18:20:56 -0800	[thread overview]
Message-ID: <20171128022056.GE21412@magnolia> (raw)
In-Reply-To: <44410519-fd0d-2527-c5cd-e23032eba299@redhat.com>

On Mon, Nov 27, 2017 at 06:04:55PM -0600, Eric Sandeen wrote:
> It's only used for tracepoints so it's relatively harmless,
> but the offset is calculated incorrectly in xfs_scrub_quota_item.
> 
> qi_dqperchunk is the nr. of dquots per "chunk" which we have
> conveniently *cough* defined to always be 1 FSB.  Therefore 
> block_offset * qi_dqperchunk == first id in that chunk,
> and so offset = id / qi_dqperchunk
> 
> id * dqperchunk is ... meaningless.
> 
> Fixes-coverity-id: 1423965
> Fixes: c2fc338c ("xfs: scrub quota information")
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok, will test
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
> 
> compile-tested only
> 
> diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c
> index 8e58ba8..2eac160 100644
> --- a/fs/xfs/scrub/quota.c
> +++ b/fs/xfs/scrub/quota.c
> @@ -107,7 +107,7 @@
>  	unsigned long long		rcount;
>  	xfs_ino_t			fs_icount;
>  
> -	offset = id * qi->qi_dqperchunk;
> +	offset = id / qi->qi_dqperchunk;
>  
>  	/*
>  	 * We fed $id and DQNEXT into the xfs_qm_dqget call, which means
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2017-11-28  2:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  0:04 [PATCH] xfs: calculate correct offset in xfs_scrub_quota_item Eric Sandeen
2017-11-28  2:20 ` Darrick J. Wong [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=20171128022056.GE21412@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.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;
as well as URLs for NNTP newsgroup(s).