From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 2F23520958BD7 for ; Tue, 12 Sep 2017 02:36:13 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 12 Sep 2017 02:39:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,382,1500966000"; d="scan'208";a="150843332" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 12 Sep 2017 02:39:09 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 02:39:09 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 02:39:08 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.39]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0319.002; Tue, 12 Sep 2017 17:39:07 +0800 From: "Zeng, Star" To: Paulo Alcantara , "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Ni, Ruiyu" , "Gao, Liming" , "Laszlo Ersek (lersek@redhat.com)" , "Zeng, Star" Thread-Topic: [PATCH v2 3/3] MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools Thread-Index: AQHTKsWjkXE6T1phHUybPyAQBnQ+TqKw/qQw Date: Tue, 12 Sep 2017 09:39:05 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B940205@shsmsx102.ccr.corp.intel.com> References: <1505110623-381040-1-git-send-email-dandan.bi@intel.com> <1505110623-381040-3-git-send-email-dandan.bi@intel.com> In-Reply-To: <1505110623-381040-3-git-send-email-dandan.bi@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2 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: , X-List-Received-Date: Tue, 12 Sep 2017 09:36:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Paulo, There is change(type cast to INT64) below in this patch. After check, we fo= und the " if (Offset < 0) " should be always false comparison as Offset is = UINT64 type. I have suggested Dandan to remove this change(type case to INT64) at v3 pat= ch series https://lists.01.org/pipermail/edk2-devel/2017-September/014523.h= tml. Could you help check and fix the code appropriately? if (Offset < 0) { - Offset =3D -(Offset); + Offset =3D - (INT64) (Offset); } Thanks, Star -----Original Message----- From: Bi, Dandan=20 Sent: Monday, September 11, 2017 2:17 PM To: edk2-devel@lists.01.org Cc: Dong, Eric ; Paulo Alcantara ; N= i, Ruiyu ; Zeng, Star Subject: [PATCH v2 3/3] MdeModulePkg/UdfDxe: Add type cast to fix build fai= lure in VS tools Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- .../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 ea3f5fb..bf33ae4 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -477,11 +477,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. // @@ -814,20 +814,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 // @@ -849,11 +849,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 @@ -938,29 +938,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); @@ -1081,11 +1081,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 @@ -1109,11 +1109,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