From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/3] xfs: complain if anyone tries to create a too-large buffer log item
Date: Wed, 8 Jan 2020 00:51:31 -0800 [thread overview]
Message-ID: <20200108085131.GB12889@infradead.org> (raw)
In-Reply-To: <157845709897.84011.1433283906403215456.stgit@magnolia>
On Tue, Jan 07, 2020 at 08:18:19PM -0800, Darrick J. Wong wrote:
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 3984779e5911..bfbe8a5b8959 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -761,18 +761,25 @@ xfs_buf_item_init(
> * buffer. This makes the implementation as simple as possible.
> */
> error = xfs_buf_item_get_format(bip, bp->b_map_count);
> - ASSERT(error == 0);
> - if (error) { /* to stop gcc throwing set-but-unused warnings */
> - kmem_cache_free(xfs_buf_item_zone, bip);
> - return error;
> + if (error) {
> + xfs_err(mp, "could not allocate buffer item, err=%d", error);
> + goto err;
> }
The error handling here is weird, as xfs_buf_item_get_format can't fail
to start with. I'd rather see a prep patch removing the bogus check
for the kmem_zalloc and change the return value from
xfs_buf_item_get_format to void.
Otherwise the patch looks good.
next prev parent reply other threads:[~2020-01-08 8:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 4:18 [PATCH 0/3] xfs: fix buf log item memory corruption on non-amd64 Darrick J. Wong
2020-01-08 4:18 ` [PATCH 1/3] xfs: refactor remote attr value buffer invalidation Darrick J. Wong
2020-01-08 8:49 ` Christoph Hellwig
2020-01-08 17:06 ` Darrick J. Wong
2020-01-08 4:18 ` [PATCH 2/3] xfs: complain if anyone tries to create a too-large buffer log item Darrick J. Wong
2020-01-08 8:51 ` Christoph Hellwig [this message]
2020-01-08 17:22 ` Darrick J. Wong
2020-01-08 4:18 ` [PATCH 3/3] xfs: make struct xfs_buf_log_format have a consistent size Darrick J. Wong
2020-01-08 8:54 ` Christoph Hellwig
2020-01-08 16:32 ` Darrick J. Wong
2020-01-08 17:17 ` Darrick J. Wong
2020-01-08 21:51 ` Dave Chinner
2020-01-08 22:33 ` Darrick J. Wong
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=20200108085131.GB12889@infradead.org \
--to=hch@infradead.org \
--cc=darrick.wong@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox