bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ext2fs: fix invalid check


From: Samuel Thibault
Subject: Re: [PATCH] ext2fs: fix invalid check
Date: Tue, 18 Jan 2022 22:35:06 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Etienne Brateau, le mar. 18 janv. 2022 22:11:40 +0100, a ecrit:
> log2_dev_block_per_fs_block is unsigned so it won’t never be less than 0
> and the check is then always false. Instead check the two values directly
> before doing the substraction.

applied, thanks!
> ---
>  ext2fs/hyper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c
> index 6ef2b8c3..e77c0266 100644
> --- a/ext2fs/hyper.c
> +++ b/ext2fs/hyper.c
> @@ -84,11 +84,11 @@ get_hypermetadata (void)
>      ext2_panic ("block size %d is too big (max is %d bytes)",
>               block_size, EXT2_MAX_BLOCK_SIZE);
>  
> -  log2_dev_blocks_per_fs_block = log2_block_size - store->log2_block_size;
> -  if (log2_dev_blocks_per_fs_block < 0)
> +  if (log2_block_size < store->log2_block_size)
>      ext2_panic ("block size %d isn't a power-of-two multiple of the device"
>               " block size (%zd)!",
>               block_size, store->block_size);
> +  log2_dev_blocks_per_fs_block = log2_block_size - store->log2_block_size;
>  
>    log2_stat_blocks_per_fs_block = 0;
>    while ((512 << log2_stat_blocks_per_fs_block) < block_size)
> -- 
> 2.34.1
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]