search for: zero_dev_start

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

2012 Oct 24
2
[BUG][BTRFS-PROGS] Fix Bug to corrupt the img file
...code-trick.com> --- utils.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/utils.c b/utils.c index 205e667..3c88d2e 100644 --- a/utils.c +++ b/utils.c @@ -441,7 +441,7 @@ static int zero_blocks(int fd, off_t start, size_t len) return ret; } -static int zero_dev_start(int fd) +static int zero_dev_start(int fd, u64 dev_size) { 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; +...