From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Qian Cai <cai@lca.pw>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] xfs: fix an undefined behaviour in _da3_path_shift
Date: Tue, 25 Feb 2020 14:05:27 -0800 [thread overview]
Message-ID: <20200225220527.GX6740@magnolia> (raw)
In-Reply-To: <F151ED18-55CF-482E-98BE-45A5A4D9A565@lca.pw>
On Tue, Feb 25, 2020 at 04:55:56PM -0500, Qian Cai wrote:
>
>
> > On Feb 25, 2020, at 4:40 PM, Christoph Hellwig <hch@infradead.org> wrote:
> >
> > In xfs_da3_path_shift() blk can be assigned to state->path.blk[-1] if
> > state->path.active is 1 (which is a valid state) when it tries to add an
> > entry > to a single dir leaf block and then to shift forward to see if
> > there's a sibling block that would be a better place to put the new
> > entry. This causes a KASAN warning given
>
> s/KASAN/UBSAN/
>
> > negative array indices are
> > undefined behavior in C. In practice the warning is entirely harmless
> > given that blk is never dereference in this case, but it is still better
> > to fix up the warning and slightly improve the code.
>
> Agree. This is better.
>
> Darrick, do you need me to send a v3 for it or you could squash this in?
Please send a v3. The code in v2 looked fine to me.
--D
prev parent reply other threads:[~2020-02-25 22:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 19:53 [PATCH v2] xfs: fix an undefined behaviour in _da3_path_shift Qian Cai
2020-02-25 21:40 ` Christoph Hellwig
2020-02-25 21:55 ` Qian Cai
2020-02-25 22:05 ` 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=20200225220527.GX6740@magnolia \
--to=darrick.wong@oracle.com \
--cc=cai@lca.pw \
--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