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.
---
 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