Re: [BUG][BTRFS-PROGS] Fix Bug to corrupt the img file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Got it.

2012/10/25 David Sterba <dave@xxxxxxxx>:
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux