From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 48D8320958BD7 for ; Tue, 12 Sep 2017 02:37:59 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2017 02:40:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,382,1500966000"; d="scan'208";a="1217676719" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 12 Sep 2017 02:40:55 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 02:40:54 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 02:40:53 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Tue, 12 Sep 2017 17:40:25 +0800 From: "Ni, Ruiyu" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , Paulo Alcantara , "Zeng, Star" Thread-Topic: [PATCH v3 1/3] MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools Thread-Index: AQHTK6UQNvnwgAxJMUqQSLnL/2B5qaKw/rBg Date: Tue, 12 Sep 2017 09:40:24 +0000 Deferred-Delivery: Tue, 12 Sep 2017 09:40:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA2C0B8@SHSMSX104.ccr.corp.intel.com> References: <1505206576-406236-1-git-send-email-dandan.bi@intel.com> <1505206576-406236-2-git-send-email-dandan.bi@intel.com> In-Reply-To: <1505206576-406236-2-git-send-email-dandan.bi@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 1/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:37:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Bi, Dandan > Sent: Tuesday, September 12, 2017 4:56 PM > To: edk2-devel@lists.01.org > Cc: Dong, Eric ; Paulo Alcantara ; > Ni, Ruiyu ; Zeng, Star > Subject: [PATCH v3 1/3] MdeModulePkg/UdfDxe: Add type cast to fix build > failure in VS tools >=20 > V3: Remove one unnecessay type cast in patch 1. > Codes: > if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) { > Offset =3D ReadFileInfo->FilePosition - FilePosition; > if (Offset < 0) { > Offset =3D -(Offset) > } > ... > } > offset is UINT64 can not < 0, so the code logic may have some issue. > and Offset =3D -(Offset) may build failure in some circumstance. > previously type case Offset to INT64 to fix build block. Now remove the t= ype > cast. Then can to check the code logic later. >=20 > 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 | 16 ++++++++--= ------ > 1 file changed, 8 insertions(+), 8 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c > b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c > index 7d7f722..5c5b5e3 100644 > --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c > +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c > @@ -470,11 +470,11 @@ DuplicateFid ( > OUT UDF_FILE_IDENTIFIER_DESCRIPTOR **NewFileIdentifierDesc > ) > { > *NewFileIdentifierDesc =3D > (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool ( > - GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); > + (UINTN) GetFidDescriptorLength (FileIdentifierDesc), > + FileIdentifierDesc); > } >=20 > // > // Duplicate either a given File Entry or a given Extended File Entry. > // > @@ -807,20 +807,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 > // > @@ -842,11 +842,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 + > + ExtentLength), *Buffer); > if (*Buffer =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } > } >=20 > @@ -931,29 +931,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; > } >=20 > @@ -1097,11 +1097,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; > -- > 1.9.5.msysgit.1