From 0c5d55e52d27be933e9e61b82bd386943bd9e05c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E7=8E=AE=E6=96=87?= Date: Mon, 28 Jul 2025 14:32:13 +0800 Subject: [PATCH] libblkid: (ext) reduce false positive MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡玮文 --- libblkid/src/superblocks/ext.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libblkid/src/superblocks/ext.c b/libblkid/src/superblocks/ext.c index c0779c233..ab4d7a827 100644 --- a/libblkid/src/superblocks/ext.c +++ b/libblkid/src/superblocks/ext.c @@ -180,6 +180,15 @@ static struct ext2_super_block *ext_get_super( return NULL; #endif } + } else { + /* + * For legacy fs without checksum, additionally verify the + * block size to reduce false positive. Currently max allowed + * block size is 64KiB (s_log_block_size <= 6), check for 256 + * to be more future proof. + */ + if (le32_to_cpu(es->s_log_block_size) >= 256) + return NULL; } if (fc) *fc = le32_to_cpu(es->s_feature_compat); -- 2.47.2