From nobody Sun Nov 24 09:38:07 2024 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+88320+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+88320+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1648800209; cv=none; d=zohomail.com; s=zohoarc; b=gzW8FOwCuE0Y887nnInsfihJ5+03iPTr9Th1ST5tKYkf8j1/vXrSpFYbwfiV86LVCIELIdceHoro3tEWRGp1nhRCz6DC83clvfrf6Ge0Vpujwy2Pm9CDe7JSe1CGRPqnGuFf0QExy4EQxcBn14ySAl3dQKevhFRO4SFvm8iavkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648800209; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=x6tYrHrkmX+uSLY7VQtNEn/T8/qZ+JsRnNg5+nTQC0E=; b=R6BqX41sQHxmX0/tyvHk9ZDqd99cMwxp+zG1Qo21VNZU8tVEo0Bh8ev/0mESS8LudteYrlBGtu46+fbB4FVbCcAZoe2xKxtlL2+xUwFsZ6ZmcPdBNOLJlkGBI9XO2VOR5NOmKyG10IzmUQXCIxIO6dPVpZ75hrsK0PXEoNN64Nw= 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+88320+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1648800208873124.5065426616585; Fri, 1 Apr 2022 01:03:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id LKqWYY1788612xVPCUXxV6i4; Fri, 01 Apr 2022 01:03:28 -0700 X-Received: from smarthost01a.ixn.mail.zen.net.uk (smarthost01a.ixn.mail.zen.net.uk [212.23.1.20]) by mx.groups.io with SMTP id smtpd.web08.8012.1648800207037010039 for ; Fri, 01 Apr 2022 01:03:27 -0700 X-Received: from [51.148.147.4] (helo=sean-StarBook.lan) by smarthost01a.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1naCFd-0008MX-QX; Fri, 01 Apr 2022 08:03:21 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: Sean Rhodes , Jian J Wang , Hao A Wu , Liming Gao Subject: [edk2-devel] [PATCH] MdeModulePkg/FaultTolerantWriteDxe: Don't check for address alignment Date: Fri, 1 Apr 2022 09:03:17 +0100 Message-Id: <9b62668edf810c4603230dc33db14c4bc3de4fe3.1648800196.git.sean@starlabs.systems> MIME-Version: 1.0 X-Originating-smarthost01a-IP: [51.148.147.4] Feedback-ID: 51.148.147.4 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,sean@starlabs.systems X-Gm-Message-State: NZ0DFnLUpPtjJ6BUfnO4SaR9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648800208; bh=y7ZS0cFSnVY22qtDzay8gjI2cQEtl/QRhIYtubj+wac=; h=Cc:Date:From:Reply-To:Subject:To; b=fy3ib/8Eh/69nLrn6B6CoT4vRqqBvSd+wE6fRedJTm+JdV6+5/xII8aLEqckGDpAU8o TcbEw45wf+EpobRKawO3mUh9E11qH4MwNG7IfrfjStiCGwb+y+jAw7J4kmW8b3N9qu52A q5cjyTHn3qf4wkarp1WtNIAp8VLKJtH5U1s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648800210928100003 Content-Type: text/plain; charset="utf-8" WorkSpaceAddress and SpareAreaAddress point into MMIO, which isn't always aligned. Remove the check for block alignment to avoid false assertions. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Sean Rhodes Change-Id: Ia1c1f44b6a0e7f32cac0d7806e74d729e5d83a6d --- .../Universal/FaultTolerantWriteDxe/FtwMisc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c b/MdeMo= dulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c index 661e148767..3b9ff1c828 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c @@ -1121,12 +1121,10 @@ FindFvbForFtw ( FtwDevice->NumberOfWorkSpaceBlock =3D FTW_BLOCKS (FtwDevice->Ftw= WorkSpaceBase + FtwDevice->FtwWorkSpaceSize, FtwDevice->WorkBlockSize); if (FtwDevice->FtwWorkSpaceSize >=3D FtwDevice->WorkBlockSize) { // - // Check the alignment of work space address and length, they = should be block size aligned when work space size is larger than one block = size. + // Check the alignment of work space length, it should be bloc= k size aligned when work space size is larger than one block size. // - if (((FtwDevice->WorkSpaceAddress & (FtwDevice->WorkBlockSize = - 1)) !=3D 0) || - ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize -= 1)) !=3D 0)) - { - DEBUG ((DEBUG_ERROR, "Ftw: Work space address or length is n= ot block size aligned when work space size is larger than one block size\n"= )); + if ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize - = 1)) !=3D 0) { + DEBUG ((EFI_D_ERROR, "Ftw: Work space length is not block si= ze aligned when work space size is larger than one block size\n")); FreePool (HandleBuffer); ASSERT (FALSE); return EFI_ABORTED; @@ -1171,12 +1169,10 @@ FindFvbForFtw ( } =20 // - // Check the alignment of spare area address and length, they sh= ould be block size aligned + // Check the alignment of spare area length, it should be block = size aligned // - if (((FtwDevice->SpareAreaAddress & (FtwDevice->SpareBlockSize -= 1)) !=3D 0) || - ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - = 1)) !=3D 0)) - { - DEBUG ((DEBUG_ERROR, "Ftw: Spare area address or length is not= block size aligned\n")); + if ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - 1= )) !=3D 0) { + DEBUG ((EFI_D_ERROR, "Ftw: Spare area address or length is not= block size aligned\n")); FreePool (HandleBuffer); // // Report Status Code EFI_SW_EC_ABORTED. --=20 2.32.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 (#88320): https://edk2.groups.io/g/devel/message/88320 Mute This Topic: https://groups.io/mt/90173290/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-