From nobody Thu Dec 26 01:21:41 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505108727492105.87079835381417; Sun, 10 Sep 2017 22:45:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 129362095BB84; Sun, 10 Sep 2017 22:42:31 -0700 (PDT) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2BFDE21959CAD for ; Sun, 10 Sep 2017 22:42:30 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 10 Sep 2017 22:45:25 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga002.jf.intel.com with ESMTP; 10 Sep 2017 22:45:24 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,376,1500966000"; d="scan'208";a="133919234" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 11 Sep 2017 13:44:38 +0800 Message-Id: <1505108680-375928-2-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1505108680-375928-1-git-send-email-dandan.bi@intel.com> References: <1505108680-375928-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [patch 1/3] MdeModulePkg/PartitionDxe: Don't use non-constant expression in array X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove the DescriptorLBAs[] array with non-constant expression to fix non-constant aggregate initializer warning in VS tool chains. Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Paulo Alcantara --- MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c | 93 ++++++++++++++++++++--= ---- 1 file changed, 72 insertions(+), 21 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/= Universal/Disk/PartitionDxe/Udf.c index 3347b48..28385f0 100644 --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c @@ -46,34 +46,85 @@ FindAnchorVolumeDescriptorPointer ( IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint ) { EFI_STATUS Status; - UINT32 BlockSize =3D BlockIo->Media->BlockSize; - EFI_LBA EndLBA =3D BlockIo->Media->LastBlock; - EFI_LBA DescriptorLBAs[] =3D { 256, EndLBA - 256, EndLBA, 512 }; - UINTN Index; + UINT32 BlockSize; + EFI_LBA EndLBA; =20 - for (Index =3D 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) { - Status =3D DiskIo->ReadDisk ( - DiskIo, - BlockIo->Media->MediaId, - MultU64x32 (DescriptorLBAs[Index], BlockSize), - sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), - (VOID *)AnchorPoint - ); - if (EFI_ERROR (Status)) { - return Status; - } - // - // Check if read LBA has a valid AVDP descriptor. - // - if (IS_AVDP (AnchorPoint)) { - return EFI_SUCCESS; - } + BlockSize =3D BlockIo->Media->BlockSize; + EndLBA =3D BlockIo->Media->LastBlock; + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (256, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (EndLBA - 256, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (EndLBA, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; } // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (512, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + // // No AVDP found. // return EFI_VOLUME_CORRUPTED; } =20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu Dec 26 01:21:41 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505108731480534.9880049733226; Sun, 10 Sep 2017 22:45:31 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 49C2A2095DCAE; Sun, 10 Sep 2017 22:42:35 -0700 (PDT) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 50F0721959CAD for ; Sun, 10 Sep 2017 22:42:34 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 10 Sep 2017 22:45:29 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga002.jf.intel.com with ESMTP; 10 Sep 2017 22:45:28 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,376,1500966000"; d="scan'208";a="133919246" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 11 Sep 2017 13:44:39 +0800 Message-Id: <1505108680-375928-3-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1505108680-375928-1-git-send-email-dandan.bi@intel.com> References: <1505108680-375928-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [patch 2/3] MdeModulePkg/UdfDxe: Don't use non-constant expression in array X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove the DescriptorLBAs[] array with non-constant expression to fix non-constant aggregate initializer warning in VS tool chains. Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Paulo Alcantara --- .../Universal/Disk/UdfDxe/FileSystemOperations.c | 93 +++++++++++++++++-= ---- 1 file changed, 72 insertions(+), 21 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/Md= eModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 0de9c71..03fda16 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -20,34 +20,85 @@ FindAnchorVolumeDescriptorPointer ( IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint ) { EFI_STATUS Status; - UINT32 BlockSize =3D BlockIo->Media->BlockSize; - EFI_LBA EndLBA =3D BlockIo->Media->LastBlock; - EFI_LBA DescriptorLBAs[] =3D { 256, EndLBA - 256, EndLBA, 512 }; - UINTN Index; + UINT32 BlockSize; + EFI_LBA EndLBA; =20 - for (Index =3D 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) { - Status =3D DiskIo->ReadDisk ( - DiskIo, - BlockIo->Media->MediaId, - MultU64x32 (DescriptorLBAs[Index], BlockSize), - sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), - (VOID *)AnchorPoint - ); - if (EFI_ERROR (Status)) { - return Status; - } - // - // Check if read LBA has a valid AVDP descriptor. - // - if (IS_AVDP (AnchorPoint)) { - return EFI_SUCCESS; - } + BlockSize =3D BlockIo->Media->BlockSize; + EndLBA =3D BlockIo->Media->LastBlock; + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (256, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (EndLBA - 256, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; } // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (EndLBA, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + Status =3D DiskIo->ReadDisk ( + DiskIo, + BlockIo->Media->MediaId, + MultU64x32 (512, BlockSize), + sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), + (VOID *)AnchorPoint + ); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Check if read LBA has a valid AVDP descriptor. + // + if (IS_AVDP (AnchorPoint)) { + return EFI_SUCCESS; + } + + // // No AVDP found. // return EFI_VOLUME_CORRUPTED; } =20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu Dec 26 01:21:41 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505108733889686.552032989961; Sun, 10 Sep 2017 22:45:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 80F4D21CEB0E3; Sun, 10 Sep 2017 22:42:37 -0700 (PDT) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7AD8521E87985 for ; Sun, 10 Sep 2017 22:42:36 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 10 Sep 2017 22:45:31 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga002.jf.intel.com with ESMTP; 10 Sep 2017 22:45:30 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,376,1500966000"; d="scan'208";a="133919259" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 11 Sep 2017 13:44:40 +0800 Message-Id: <1505108680-375928-4-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1505108680-375928-1-git-send-email-dandan.bi@intel.com> References: <1505108680-375928-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [patch 3/3] MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Paulo Alcantara --- .../Universal/Disk/UdfDxe/FileSystemOperations.c | 18 +++++++++-----= ---- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/Md= eModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 03fda16..f4ebf1f 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -521,11 +521,11 @@ DuplicateFid ( OUT UDF_FILE_IDENTIFIER_DESCRIPTOR **NewFileIdentifierDesc ) { *NewFileIdentifierDesc =3D (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool ( - GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); + (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierD= esc); } =20 // // Duplicate either a given File Entry or a given Extended File Entry. // @@ -858,20 +858,20 @@ GetAedAdsData ( } =20 // // Allocate buffer to read in AED's data. // - *Data =3D AllocatePool (*Length); + *Data =3D AllocatePool ((UINTN) (*Length)); if (*Data =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 return DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, Offset, - *Length, + (UINTN) (*Length), *Data ); } =20 // @@ -893,11 +893,11 @@ GrowUpBufferToNextAd ( *Buffer =3D AllocatePool (ExtentLength); if (*Buffer =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } } else { - *Buffer =3D ReallocatePool (Length, Length + ExtentLength, *Buffer); + *Buffer =3D ReallocatePool ((UINTN) Length, (UINTN) (Length + ExtentLe= ngth), *Buffer); if (*Buffer =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } } =20 @@ -982,29 +982,29 @@ ReadFile ( ReadFileInfo->ReadLength =3D Length; } else if (ReadFileInfo->Flags =3D=3D READ_FILE_ALLOCATE_AND_READ) { // // Allocate buffer for starting read data. // - ReadFileInfo->FileData =3D AllocatePool (Length); + ReadFileInfo->FileData =3D AllocatePool ((UINTN) Length); if (ReadFileInfo->FileData =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 // // Read all inline data into ReadFileInfo->FileData // - CopyMem (ReadFileInfo->FileData, Data, Length); + CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length); ReadFileInfo->ReadLength =3D Length; } else if (ReadFileInfo->Flags =3D=3D READ_FILE_SEEK_AND_READ) { // // If FilePosition is non-zero, seek file to FilePosition, read // FileDataSize bytes and then updates FilePosition. // CopyMem ( ReadFileInfo->FileData, (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition), - ReadFileInfo->FileDataSize + (UINTN) ReadFileInfo->FileDataSize ); =20 ReadFileInfo->FilePosition +=3D ReadFileInfo->FileDataSize; } else { ASSERT (FALSE); @@ -1125,11 +1125,11 @@ ReadFile ( } =20 if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) { Offset =3D ReadFileInfo->FilePosition - FilePosition; if (Offset < 0) { - Offset =3D -(Offset); + Offset =3D - (INT64) (Offset); } } else { Offset =3D 0; } =20 @@ -1153,11 +1153,11 @@ ReadFile ( // Status =3D DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, Offset + MultU64x32 (Lsn, LogicalBlockSize), - DataLength, + (UINTN) DataLength, (VOID *)((UINT8 *)ReadFileInfo->FileData + DataOffset) ); if (EFI_ERROR (Status)) { goto Error_Read_Disk_Blk; --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel