From nobody Sat Feb 7 07:10:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+99139+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+99139+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1674811793; cv=none; d=zohomail.com; s=zohoarc; b=MQKKICXkDvYN31H+ssgpar47LrDBAWwk1ZByowAhIhxufjAitjt2xUlt3MesnN71VJUYl8L5OMp9+xpelVj78oHOkJhHQ9sIsZtB4pRPGM9uMK/ejPSP1BUl5kfElTMPy+Jxs9B01Iky7rwTHJTnPOuoLiDhyWrNdYgPNj4GvrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674811793; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=21A3jZEGi34ojvewE2Vwf0Iik5nn+iX/RSJWe8sO+4g=; b=bzF4kEyDlk0i+o7BJ7WzDbX9JpDFEJ49A1WL8BfJtk9cHXEiZ15q5YUOUsVaT3w+nrpg30wLdxi0HHhCVdf/Lsf73uOFGfmEAXZ3vtXlypr80QyuvWA0SWcgtsbr5keDb+GPgmwcjhmYaC+rSeiOX1S2z2S7eIPgHVkTumDCuuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+99139+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1674811793264364.8429237807312; Fri, 27 Jan 2023 01:29:53 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9sEEYY1788612xoF4YyxiShx; Fri, 27 Jan 2023 01:29:52 -0800 X-Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mx.groups.io with SMTP id smtpd.web11.98570.1674811791892615145 for ; Fri, 27 Jan 2023 01:29:52 -0800 X-Received: by mail-lf1-f51.google.com with SMTP id o20so7236246lfk.5 for ; Fri, 27 Jan 2023 01:29:51 -0800 (PST) X-Gm-Message-State: wLjr7Q6w5HEaQicxC9u7VyYOx1787277AA= X-Google-Smtp-Source: AMrXdXsfizZ44ZhWyly8mV/kWtna1DxvV01uG4WxLpjMdLHrznlTL2a75H/lqZVp5YRW7lKKyFK+Vw== X-Received: by 2002:a05:6512:114e:b0:4d0:8469:b196 with SMTP id m14-20020a056512114e00b004d08469b196mr12391671lfg.3.1674811790107; Fri, 27 Jan 2023 01:29:50 -0800 (PST) X-Received: from localhost.localdomain ([176.62.67.29]) by smtp.gmail.com with ESMTPSA id t11-20020a056512068b00b004cc8196a308sm229071lfe.98.2023.01.27.01.29.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 27 Jan 2023 01:29:49 -0800 (PST) From: "Savva Mitrofanov" To: devel@edk2.groups.io Cc: =?UTF-8?q?Marvin=20H=C3=A4user?= , Pedro Falcato , Vitaly Cheptsov Subject: [edk2-devel] [edk2-platforms][PATCH v3 03/11] Ext4Pkg: Fix division by zero by adding check for s_inodes_per_group Date: Fri, 27 Jan 2023 15:29:37 +0600 Message-Id: <20230127092945.94389-4-savvamtr@gmail.com> In-Reply-To: <20230127092945.94389-1-savvamtr@gmail.com> References: <20230127092945.94389-1-savvamtr@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,savvamtr@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1674811792; bh=WpXjbcbwBxSCuR5disBmf0vaWBnJ8NpmewsXkYTbEP4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Oy36ppahkms+iCW10iQRi4mspEVhqadHZCCUkO0TnJdPfETvIJHY0Z7TM7FcwBDC2Sr OhcxxSSQgIBtwV310nPCKNYILiLERW6EcjjIMhzTlk2lPYcVWzyzRMkZbKAxNoJC6KzFw Mmki6oQZ6VpE3B370Jnak78Otee7hL9V/KQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1674811794646100016 Content-Type: text/plain; charset="utf-8" Superblock s_inodes_per_group field can't be zero, it leads to division by zero in BlockGroup routine Ext4ReadInode Cc: Marvin H=C3=A4user Cc: Pedro Falcato Cc: Vitaly Cheptsov Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.") Signed-off-by: Savva Mitrofanov Reviewed-by: Marvin H=C3=A4user Reviewed-by: Pedro Falcato --- Features/Ext4Pkg/Ext4Dxe/Superblock.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c b/Features/Ext4Pkg/Ext4D= xe/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->Bl= ockSize --=20 2.39.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99139): https://edk2.groups.io/g/devel/message/99139 Mute This Topic: https://groups.io/mt/96562692/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-