From: Qian Cai <cai@lca.pw>
To: Christoph Hellwig <hch@infradead.org>
Cc: darrick.wong@oracle.com, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: fix an undefined behaviour in _da3_path_shift
Date: Tue, 25 Feb 2020 13:23:06 -0500 [thread overview]
Message-ID: <1582654986.7365.120.camel@lca.pw> (raw)
In-Reply-To: <20200225180725.GA29862@infradead.org>
On Tue, 2020-02-25 at 10:07 -0800, Christoph Hellwig wrote:
> I think we code do this a tad more cleaner, something like:
>
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index 875e04f82541..542a4edfcf54 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -1986,7 +1986,8 @@ xfs_da3_path_shift(
> ASSERT(path != NULL);
> ASSERT((path->active > 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
> level = (path->active-1) - 1; /* skip bottom layer in path */
> - for (blk = &path->blk[level]; level >= 0; blk--, level--) {
> + for ( ; level >= 0; level--) {
> + blk = &path->blk[level];
> xfs_da3_node_hdr_from_disk(dp->i_mount, &nodehdr,
> blk->bp->b_addr);
>
Yes, indeed. I'll send a v2 until Darrick is still not convinced that
"path->active == 1" could reach here?
prev parent reply other threads:[~2020-02-25 18:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 14:37 [PATCH] xfs: fix an undefined behaviour in _da3_path_shift Qian Cai
2020-02-25 15:28 ` Darrick J. Wong
2020-02-25 15:46 ` Qian Cai
2020-02-25 19:08 ` Darrick J. Wong
2020-02-25 18:07 ` Christoph Hellwig
2020-02-25 18:23 ` Qian Cai [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=1582654986.7365.120.camel@lca.pw \
--to=cai@lca.pw \
--cc=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox