summaryrefslogtreecommitdiff
path: root/lib/ext2fs/mkjournal.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ext2fs/mkjournal.c')
-rw-r--r--lib/ext2fs/mkjournal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index ca8e733b..e55dcbda 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -170,9 +170,11 @@ errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num,
/* OK, do the write loop */
j=0;
while (j < num) {
- if (blk % STRIDE_LENGTH)
+ if (blk % STRIDE_LENGTH) {
count = STRIDE_LENGTH - (blk % STRIDE_LENGTH);
- else {
+ if (count > (num - j))
+ count = num - j;
+ } else {
count = num - j;
if (count > STRIDE_LENGTH)
count = STRIDE_LENGTH;