From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.102884.1674829002239812879 for ; Fri, 27 Jan 2023 06:16:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=CyTfFuLo; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id AA60124055A for ; Fri, 27 Jan 2023 15:16:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1674829000; bh=GuLW4BSnx5+FRWEMELUDfeaIx9xODSCSxsbRP0QDZ84=; h=Subject:From:Date:Cc:To:From; b=CyTfFuLorqG1Cmv8z1kM4a+MfWNdBqpOTr3yvQ/8cf6i56pSyBVte4Y/lmO3rwoaQ 5XEmZuSOBQxO20XHwpIyXYfJBjsrrykA6huRl0oLHHlyJZdhnlFsqg/3iU1NZM3pxD z59oii9FaHPS+oO1p60idZr8rIZnj/cOmdXvZlePC0ECIucbeoK9OxCaEj8SgHz2ei QITSTVKmuBwioJE8B22YlZ8cVLS4tpJVUppj1RCZpp09ZvvpGo/l+h3di8MUYidgBS adyKEzZkqK4wU1HnRdx+Hl8y/oc7m88RPDeXaS7qow5o6WNzhZWosILZkSQNre0sJK 6nqH/mE3bA7RA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P3KQ01FNhz6tmd; Fri, 27 Jan 2023 15:16:40 +0100 (CET) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [edk2-platforms][PATCH v3 03/11] Ext4Pkg: Fix division by zero by adding check for s_inodes_per_group From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= In-Reply-To: Date: Fri, 27 Jan 2023 14:16:30 +0000 Cc: Savva Mitrofanov , devel@edk2.groups.io, Vitaly Cheptsov Message-Id: <2D926C5B-F980-4BFF-893F-DBAF66CE7DD6@posteo.de> References: <20230127092945.94389-1-savvamtr@gmail.com> <20230127092945.94389-4-savvamtr@gmail.com> To: Pedro Falcato Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Reviewed-by: Marvin H=C3=A4user > On 27. Jan 2023, at 15:13, Pedro Falcato = wrote: >=20 > On Fri, Jan 27, 2023 at 9:29 AM Savva Mitrofanov = wrote: >>=20 >> Superblock s_inodes_per_group field can't be zero, it leads to = division >> by zero in BlockGroup routine Ext4ReadInode >>=20 >> Cc: Marvin H=C3=A4user >> Cc: Pedro Falcato >> Cc: Vitaly Cheptsov >> Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.") >> Signed-off-by: Savva Mitrofanov >> --- >> Features/Ext4Pkg/Ext4Dxe/Superblock.c | 5 +++++ >> 1 file changed, 5 insertions(+) >>=20 >> diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c = b/Features/Ext4Pkg/Ext4Dxe/Superblock.c >> index 35dcf3c007c8..be3527e4d618 100644 >> --- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c >> +++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c >> @@ -243,6 +243,11 @@ Ext4OpenSuperblock ( >>=20 >> DEBUG ((DEBUG_FS, "Read only =3D %u\n", Partition->ReadOnly)); >>=20 >> + if (Sb->s_inodes_per_group =3D=3D 0) { >> + DEBUG ((DEBUG_ERROR, "[ext4] Inodes per group can not be = zero\n")); >> + return EFI_VOLUME_CORRUPTED; >> + } >> + >> Partition->BlockSize =3D (UINT32)LShiftU64 (1024, = Sb->s_log_block_size); >>=20 >> // The size of a block group can also be calculated as 8 * = Partition->BlockSize >> -- >> 2.39.0 >>=20 >=20 > Reviewed-by: Pedro Falcato >=20 > --=20 > Pedro