Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

badblocks: Fix wrong corruption block record in write mode #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions misc/badblocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ static unsigned int test_rw (int dev, blk_t last_block,
try = last_block - currently_testing;
got = do_read (dev, read_buffer, try, block_size,
currently_testing);
for (i=0; i < got; i++) {
if (memcmp(read_buffer + i * block_size,
buffer + i * block_size,
block_size))
bb_count += bb_output(currently_testing+i, CORRUPTION_ERROR);
}
if (got == 0 && try == 1)
bb_count += bb_output(currently_testing++, READ_ERROR);
currently_testing += got;
Expand All @@ -712,12 +718,6 @@ static unsigned int test_rw (int dev, blk_t last_block,
try = blocks_at_once;
recover_block = ~0U;
}
for (i=0; i < got; i++) {
if (memcmp(read_buffer + i * block_size,
buffer + i * block_size,
block_size))
bb_count += bb_output(currently_testing+i, CORRUPTION_ERROR);
}
if (v_flag > 1)
print_status();
}
Expand Down