diff mbox

[RESEND,1/4] fs: befs: Remove redundant validation from befs_find_brun_direct

Message ID 9859a616787673d2f36ce21d4aa0220637c55001.1469588473.git.salah.triki@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Salah Triki July 27, 2016, 3:11 a.m. UTC
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 <salah.triki@gmail.com>
Acked-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
 fs/befs/datastream.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Luis de Bethencourt July 27, 2016, 3:22 p.m. UTC | #1
On 27/07/16 04:11, Salah Triki wrote:
> 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 <salah.triki@gmail.com>
> Acked-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
>  fs/befs/datastream.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
> index 26cc417..e224b9a 100644
> --- a/fs/befs/datastream.c
> +++ b/fs/befs/datastream.c
> @@ -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)) {
> 

Hi,

I have applied 1, 2 and 3 from this series into:
https://github.com/luisbg/linux-befs/tree/befs-next

I had already tested and acked the 3 commits above. Having them in the above git
branch [0] makes it easier to see the order of all recent commits.

Andrew,
I hope this process works for you. If not, let me know and I can adapt to however
you prefer it to be.

Thanks Salah :)

Luis



[0] reason for that git branch: https://lkml.org/lkml/2016/7/26/533
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
index 26cc417..e224b9a 100644
--- a/fs/befs/datastream.c
+++ b/fs/befs/datastream.c
@@ -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)) {