From: David Sterba <dsterba@suse.cz>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, ericvh@gmail.com,
lucho@ionkov.net, viro@zeniv.linux.org.uk, jlayton@kernel.org,
idryomov@gmail.com, mark@fasheh.com, jlbec@evilplan.org,
joseph.qi@linux.alibaba.com,
v9fs-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org,
ocfs2-devel@oss.oracle.com, linux-btrfs@vger.kernel.org,
clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
stable@vger.kernel.org
Subject: Re: [PATCH 7/7] btrfs: Promote to unsigned long long before multiplying
Date: Mon, 26 Oct 2020 17:21:39 +0100 [thread overview]
Message-ID: <20201026162139.GO6756@twin.jikos.cz> (raw)
In-Reply-To: <20201004180428.14494-8-willy@infradead.org>
On Sun, Oct 04, 2020 at 07:04:28PM +0100, Matthew Wilcox (Oracle) wrote:
> On 32-bit systems, these shifts will overflow for files larger than 4GB.
> Add helper functions to avoid this problem coming back.
>
> Cc: stable@vger.kernel.org
> Fixes: 73ff61dbe5ed ("Btrfs: fix device replace of a missing RAID 5/6 device")
> Fixes: be50a8ddaae1 ("Btrfs: Simplify scrub_setup_recheck_block()'s argument")
> Fixes: ff023aac3119 ("Btrfs: add code to scrub to copy read data to another disk")
> Fixes: b5d67f64f9bc ("Btrfs: change scrub to support big blocks")
> Fixes: a2de733c78fa ("btrfs: scrub")
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> fs/btrfs/scrub.c | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 354ab9985a34..ccbaf9c6e87a 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -1262,12 +1262,17 @@ static inline void scrub_stripe_index_and_offset(u64 logical, u64 map_type,
> }
> }
>
> +static u64 sblock_length(struct scrub_block *sblock)
> +{
> + return (u64)sblock->page_count * PAGE_SIZE;
page_count will be 32 at most, the type is int and this will never
overflow. The value is usualy number of pages in the arrays scrub_bio::pagev or
scrub_block::pagev bounded by SCRUB_PAGES_PER_WR_BIO (32) or
SCRUB_MAX_PAGES_PER_BLOCK (16). The scrub code does not use mappings
and it reads raw blocks to own pages and does the checksum verification.
prev parent reply other threads:[~2020-10-26 16:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-04 18:04 [PATCH 0/7] Fix a pile of 4GB file problems on 32-bit Matthew Wilcox (Oracle)
2020-10-04 18:04 ` [PATCH 1/7] 9P: Cast to loff_t before multiplying Matthew Wilcox (Oracle)
2020-10-07 5:48 ` Christoph Hellwig
2020-10-07 18:47 ` Matthew Wilcox
2020-10-26 17:14 ` Dominique Martinet
2020-10-04 18:04 ` [PATCH 2/7] buffer: Promote to unsigned long long before shifting Matthew Wilcox (Oracle)
2020-10-04 18:04 ` [PATCH 3/7] ceph: " Matthew Wilcox (Oracle)
2020-10-06 11:29 ` Jeff Layton
2020-10-06 17:20 ` Jeff Layton
2020-10-04 18:04 ` [PATCH 4/7] ocfs2: " Matthew Wilcox (Oracle)
2020-10-04 18:04 ` [PATCH 5/7] btrfs: " Matthew Wilcox (Oracle)
2020-10-09 14:18 ` Josef Bacik
2020-10-26 17:02 ` David Sterba
2020-10-04 18:04 ` [PATCH 6/7] " Matthew Wilcox (Oracle)
2020-10-09 14:18 ` Josef Bacik
2020-10-26 16:35 ` David Sterba
2020-10-26 16:44 ` Matthew Wilcox
2020-10-26 17:03 ` David Sterba
2020-10-04 18:04 ` [PATCH 7/7] btrfs: Promote to unsigned long long before multiplying Matthew Wilcox (Oracle)
2020-10-26 16:21 ` David Sterba [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=20201026162139.GO6756@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=ceph-devel@vger.kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=ericvh@gmail.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=jlbec@evilplan.org \
--cc=josef@toxicpanda.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=stable@vger.kernel.org \
--cc=v9fs-developer@lists.sourceforge.net \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).