From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.zytor.com (terminus.zytor.com [65.50.211.136]) (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 0CAA920945BFC for ; Tue, 12 Sep 2017 06:02:14 -0700 (PDT) Received: from [10.26.0.110] (corporativo.static.gvt.net.br [177.135.97.54] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id v8CD2qT3031583 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 12 Sep 2017 06:02:55 -0700 To: "Zeng, Star" , "Bi, Dandan" , "edk2-devel@lists.01.org" Cc: "Dong, Eric" , "Ni, Ruiyu" , "Gao, Liming" , "Laszlo Ersek (lersek@redhat.com)" References: <1505110623-381040-1-git-send-email-dandan.bi@intel.com> <1505110623-381040-3-git-send-email-dandan.bi@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B940205@shsmsx102.ccr.corp.intel.com> From: Paulo Alcantara Message-ID: <44bbf07f-ddf5-9a3f-3999-92f4606a5b53@zytor.com> Date: Tue, 12 Sep 2017 10:02:43 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B940205@shsmsx102.ccr.corp.intel.com> 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 13:02:14 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi, On 9/12/2017 6:39 AM, Zeng, Star wrote: > There is change(type cast to INT64) below in this patch. After check, we found 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 patch series https://lists.01.org/pipermail/edk2-devel/2017-September/014523.html. > Could you help check and fix the code appropriately? > if (Offset < 0) { > - Offset = -(Offset); > + Offset = - (INT64) (Offset); > } Oh, nice catch! I'll send a patch that fixes it and do some sanity checks later. Thank you all! Really appreciate it. Paulo > > > Thanks, > Star > -----Original Message----- > From: Bi, Dandan > Sent: Monday, September 11, 2017 2:17 PM > To: edk2-devel@lists.01.org > Cc: Dong, Eric ; Paulo Alcantara ; Ni, Ruiyu ; Zeng, Star > Subject: [PATCH v2 3/3] MdeModulePkg/UdfDxe: Add type cast to fix build failure 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/MdeModulePkg/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 = > (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool ( > - GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); > + (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); > } > > // > // Duplicate either a given File Entry or a given Extended File Entry. > // > @@ -814,20 +814,20 @@ GetAedAdsData ( > } > > // > // Allocate buffer to read in AED's data. > // > - *Data = AllocatePool (*Length); > + *Data = AllocatePool ((UINTN) (*Length)); > if (*Data == NULL) { > return EFI_OUT_OF_RESOURCES; > } > > return DiskIo->ReadDisk ( > DiskIo, > BlockIo->Media->MediaId, > Offset, > - *Length, > + (UINTN) (*Length), > *Data > ); > } > > // > @@ -849,11 +849,11 @@ GrowUpBufferToNextAd ( > *Buffer = AllocatePool (ExtentLength); > if (*Buffer == NULL) { > return EFI_OUT_OF_RESOURCES; > } > } else { > - *Buffer = ReallocatePool (Length, Length + ExtentLength, *Buffer); > + *Buffer = ReallocatePool ((UINTN) Length, (UINTN) (Length + ExtentLength), *Buffer); > if (*Buffer == NULL) { > return EFI_OUT_OF_RESOURCES; > } > } > > @@ -938,29 +938,29 @@ ReadFile ( > ReadFileInfo->ReadLength = Length; > } else if (ReadFileInfo->Flags == READ_FILE_ALLOCATE_AND_READ) { > // > // Allocate buffer for starting read data. > // > - ReadFileInfo->FileData = AllocatePool (Length); > + ReadFileInfo->FileData = AllocatePool ((UINTN) Length); > if (ReadFileInfo->FileData == NULL) { > return EFI_OUT_OF_RESOURCES; > } > > // > // Read all inline data into ReadFileInfo->FileData > // > - CopyMem (ReadFileInfo->FileData, Data, Length); > + CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length); > ReadFileInfo->ReadLength = Length; > } else if (ReadFileInfo->Flags == 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 > ); > > ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize; > } else { > ASSERT (FALSE); > @@ -1081,11 +1081,11 @@ ReadFile ( > } > > if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) { > Offset = ReadFileInfo->FilePosition - FilePosition; > if (Offset < 0) { > - Offset = -(Offset); > + Offset = - (INT64) (Offset); > } > } else { > Offset = 0; > } > > @@ -1109,11 +1109,11 @@ ReadFile ( > // > Status = 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; >