From: Brian Norris <computersforpeace@gmail.com>
To: Timofey Titovets <nefelim4ag@gmail.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs: btrfs: fix potential overflow
Date: Mon, 25 Aug 2014 23:45:22 -0700 [thread overview]
Message-ID: <20140826064522.GD3246@norris-Latitude-E6410> (raw)
In-Reply-To: <CAGqmi757Husduwnis_ci_z1Z-6tjCuOHDHt0dx=jBquguzrFbA@mail.gmail.com>
On Sun, Aug 24, 2014 at 12:44:11PM +0300, Timofey Titovets wrote:
> 2014-08-24 8:41 GMT+03:00 Brian Norris <computeaboversforpeace@gmail.com>:
> > --- a/fs/btrfs/scrub.c
> > +++ b/fs/btrfs/scrub.c
> > @@ -2320,26 +2320,26 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
> > do_div(nstripes, map->stripe_len);
> > if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
> > offset = map->stripe_len * num;
> > - increment = map->stripe_len * map->num_stripes;
> > + increment *= map->num_stripes;
> > mirror_num = 1;
> > } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
> > int factor = map->num_stripes / map->sub_stripes;
> > offset = map->stripe_len * (num / map->sub_stripes);
> > - increment = map->stripe_len * factor;
> > + increment *= factor;
> > mirror_num = num % map->sub_stripes + 1;
> > } else if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
> > - increment = map->stripe_len;
> > + increment *= 1;
> Why? I think multiple by one is useless or i miss something?
A misguided attempt to keep the code structure intact. I'll drop these
for v2.
[snip]
Thanks,
Brian
next prev parent reply other threads:[~2014-08-26 6:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-24 5:41 Brian Norris
2014-08-24 9:44 ` Timofey Titovets
2014-08-26 6:45 ` Brian Norris [this message]
2014-08-26 6:47 ` [PATCH v2] " Brian Norris
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=20140826064522.GD3246@norris-Latitude-E6410 \
--to=computersforpeace@gmail.com \
--cc=clm@fb.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nefelim4ag@gmail.com \
/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
all inboxes | Powered by JetHome®