Skip to content

Commit

Permalink
fs: befs: Remove redundant validation from befs_find_brun_direct
Browse files Browse the repository at this point in the history
The only caller of befs_find_brun_direct is befs_fblock2brun, which
already validates that the block is within the range of direct blocks.
So remove the duplicate validation.

Signed-off-by: Salah Triki <[email protected]>
Acked-by: Luis de Bethencourt <[email protected]>
  • Loading branch information
salah-triki authored and luisbg committed Oct 8, 2016
1 parent 2dfa8a6 commit d84e4a5
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions fs/befs/datastream.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,9 @@ befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
int i;
const befs_block_run *array = data->direct;
befs_blocknr_t sum;
befs_blocknr_t max_block =
data->max_direct_range >> BEFS_SB(sb)->block_shift;

befs_debug(sb, "---> %s, find %lu", __func__, (unsigned long)blockno);

if (blockno > max_block) {
befs_error(sb, "%s passed block outside of direct region",
__func__);
return BEFS_ERR;
}

for (i = 0, sum = 0; i < BEFS_NUM_DIRECT_BLOCKS;
sum += array[i].len, i++) {
if (blockno >= sum && blockno < sum + (array[i].len)) {
Expand Down

0 comments on commit d84e4a5

Please sign in to comment.