search for: btrfs_prepare_device

Displaying 1 result from an estimated 1 matches for "btrfs_prepare_device".

2012 Oct 24
2
[BUG][BTRFS-PROGS] Fix Bug to corrupt the img file
...off_t start = 0; size_t len = 2 * 1024 * 1024; @@ -451,6 +451,10 @@ static int zero_dev_start(int fd) start = 1024; len -= 1024; #endif + + if (dev_size < len) + return -EIO; + return zero_blocks(fd, start, len); } @@ -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", re...