From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.20, mailfrom: sean@starlabs.systems) 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: [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> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Originating-smarthost01a-IP: [51.148.147.4] Feedback-ID: 51.148.147.4 Content-Transfer-Encoding: quoted-printable 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);=0D if (FtwDevice->FtwWorkSpaceSize >=3D FtwDevice->WorkBlockSize) {= =0D //=0D - // 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.=0D + // Check the alignment of work space length, it should be bloc= k size aligned when work space size is larger than one block size.=0D //=0D - if (((FtwDevice->WorkSpaceAddress & (FtwDevice->WorkBlockSize = - 1)) !=3D 0) ||=0D - ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize -= 1)) !=3D 0))=0D - {=0D - 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"= ));=0D + if ((FtwDevice->WorkSpaceLength & (FtwDevice->WorkBlockSize - = 1)) !=3D 0) {=0D + 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"));=0D FreePool (HandleBuffer);=0D ASSERT (FALSE);=0D return EFI_ABORTED;=0D @@ -1171,12 +1169,10 @@ FindFvbForFtw ( }=0D =0D //=0D - // Check the alignment of spare area address and length, they sh= ould be block size aligned=0D + // Check the alignment of spare area length, it should be block = size aligned=0D //=0D - if (((FtwDevice->SpareAreaAddress & (FtwDevice->SpareBlockSize -= 1)) !=3D 0) ||=0D - ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - = 1)) !=3D 0))=0D - {=0D - DEBUG ((DEBUG_ERROR, "Ftw: Spare area address or length is not= block size aligned\n"));=0D + if ((FtwDevice->SpareAreaLength & (FtwDevice->SpareBlockSize - 1= )) !=3D 0) {=0D + DEBUG ((EFI_D_ERROR, "Ftw: Spare area address or length is not= block size aligned\n"));=0D FreePool (HandleBuffer);=0D //=0D // Report Status Code EFI_SW_EC_ABORTED.=0D --=20 2.32.0