From: Patrick Delaunay Date: Wed, 8 Mar 2023 08:49:54 +0000 (+0100) Subject: fs: ext4: check the minimal partition size to mount X-Git-Tag: baikal/mips/sdk5.8.2~5^2~15^2~1 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=ed8de23af2ce21d7d6bb371e158b5d4f1c608ad1;p=uboot.git fs: ext4: check the minimal partition size to mount No need to mount a too small partition to handle a EXT4 file system. This patch add a test on partition size before to read the SUPERBLOCK_SIZE buffer and avoid error latter in fs_devread() function. Signed-off-by: Patrick Delaunay --- diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index f50de7c089..9a9c520e22 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -2373,6 +2373,10 @@ int ext4fs_mount(unsigned part_length) struct ext2_data *data; int status; struct ext_filesystem *fs = get_fs(); + + if (part_length < SUPERBLOCK_SIZE) + return 0; + data = zalloc(SUPERBLOCK_SIZE); if (!data) return 0;