From: Rock Lee <zimilo@code-trick.com>
To: dave@jikos.cz, Rock Lee <zimilo@code-trick.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [BUG][BTRFS-PROGS] Fix Bug to corrupt the img file
Date: Thu, 25 Oct 2012 23:58:24 +0800 [thread overview]
Message-ID: <CAMRmmpLfbzAcf7M5T0UYHv7-R6PeprwGpgb-YfLfWpvp9PA8Gw@mail.gmail.com> (raw)
In-Reply-To: <20121025153731.GI10679@twin.jikos.cz>
Got it.
2012/10/25 David Sterba <dave@jikos.cz>:
> On Wed, Oct 24, 2012 at 10:04:47AM +0800, Rock Lee wrote:
>> @@ -572,7 +576,7 @@ int btrfs_prepare_device(int fd, char *file, int
>> zero_end, u64 *block_count_ret,
>> discard_blocks(fd, 0, block_count);
>> }
>>
>> - ret = zero_dev_start(fd);
>> + ret = zero_dev_start(fd, block_count);
>> if (ret) {
>> fprintf(stderr, "failed to zero device start %d\n", ret);
>> exit(1);
>
> Please add a separate check for a minimal image size instead, right after
>
> 553 block_count = device_size(fd, &st);
> 554 if (block_count == 0) {
> 555 fprintf(stderr, "unable to find %s size\n", file);
> 556 exit(1);
> 557 }
> 558 if (max_block_count)
> 559 block_count = min(block_count, max_block_count);
>
> if (block_count < 2 MB ) {
> fprintf(stderr, "Image too small (less than 2MB)");
> exit
> }
>
> thanks,
> david
prev parent reply other threads:[~2012-10-25 15:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-24 2:04 [BUG][BTRFS-PROGS] Fix Bug to corrupt the img file Rock Lee
2012-10-25 15:37 ` David Sterba
2012-10-25 15:58 ` Rock Lee [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=CAMRmmpLfbzAcf7M5T0UYHv7-R6PeprwGpgb-YfLfWpvp9PA8Gw@mail.gmail.com \
--to=zimilo@code-trick.com \
--cc=dave@jikos.cz \
--cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).