From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, pmenzel@molgen.mpg.de,
stockhausen@collogia.de
Subject: Re: [PATCH] iomap: fix integer truncation issues in the zeroing and dirtying helpers
Date: Fri, 11 Aug 2017 09:04:43 -0700 [thread overview]
Message-ID: <20170811160443.GA24087@magnolia> (raw)
In-Reply-To: <20170811151805.22896-1-hch@lst.de>
On Fri, Aug 11, 2017 at 05:18:05PM +0200, Christoph Hellwig wrote:
> Fix the min_t calls in the zeroing and dirtying helpers to perform the
> comparisms on 64-bit types, which prevents them from incorrectly
> being truncated, and larger zeroing operations being stuck in a never
> ending loop.
>
> Special thanks to Markus Stockhausen for spotting the bug.
>
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Looks fine to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
(Are you going to push this to Al yourself, or do you want me to drag it
through the xfs tree?)
> ---
> fs/iomap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 039266128b7f..59cc98ad7577 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
> unsigned long bytes; /* Bytes to write to page */
>
> offset = (pos & (PAGE_SIZE - 1));
> - bytes = min_t(unsigned long, PAGE_SIZE - offset, length);
> + bytes = min_t(loff_t, PAGE_SIZE - offset, length);
>
> rpage = __iomap_read_page(inode, pos);
> if (IS_ERR(rpage))
> @@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,
> unsigned offset, bytes;
>
> offset = pos & (PAGE_SIZE - 1); /* Within page */
> - bytes = min_t(unsigned, PAGE_SIZE - offset, count);
> + bytes = min_t(loff_t, PAGE_SIZE - offset, count);
>
> if (IS_DAX(inode))
> status = iomap_dax_zero(pos, offset, bytes, iomap);
> --
> 2.11.0
>
> --
> 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
next prev parent reply other threads:[~2017-08-11 16:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-11 15:18 [PATCH] iomap: fix integer truncation issues in the zeroing and dirtying helpers Christoph Hellwig
2017-08-11 16:04 ` Darrick J. Wong [this message]
2017-08-11 16:06 ` Christoph Hellwig
2017-08-16 21:52 ` Darrick J. Wong
2017-08-17 7:05 ` Christoph Hellwig
2017-08-12 9:00 ` Paul Menzel
2017-08-13 9:08 ` Christoph Hellwig
2017-09-11 14:50 ` Paul Menzel
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=20170811160443.GA24087@magnolia \
--to=darrick.wong@oracle.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=stockhausen@collogia.de \
/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