From 0b4c8f003ade95f4eadb8cbe7efe16008368143e Mon Sep 17 00:00:00 2001 From: "Bi, Dandan" Date: Tue, 12 Sep 2017 16:56:14 +0800 Subject: [PATCH] MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools V3: Remove one unnecessay type cast in patch 1. Codes: if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) { Offset = ReadFileInfo->FilePosition - FilePosition; if (Offset < 0) { Offset = -(Offset) } ... } Offset is UINT64 can not < 0, so the code logic may have some issue. and Offset = -(Offset) may build failure in some circumstance. Previously type cast Offset to INT64 to fix build break. Now remove the type cast. Then can to check the code logic later. 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 Reviewed-by: Star Zeng --- .../Universal/Disk/UdfDxe/FileSystemOperations.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 7d7f722188..5c5b5e3765 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -472,7 +472,7 @@ DuplicateFid ( { *NewFileIdentifierDesc = (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool ( - GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); + (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); } // @@ -809,7 +809,7 @@ GetAedAdsData ( // // Allocate buffer to read in AED's data. // - *Data = AllocatePool (*Length); + *Data = AllocatePool ((UINTN) (*Length)); if (*Data == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -818,7 +818,7 @@ GetAedAdsData ( DiskIo, BlockIo->Media->MediaId, Offset, - *Length, + (UINTN) (*Length), *Data ); } @@ -844,7 +844,7 @@ GrowUpBufferToNextAd ( 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; } @@ -933,7 +933,7 @@ ReadFile ( // // Allocate buffer for starting read data. // - ReadFileInfo->FileData = AllocatePool (Length); + ReadFileInfo->FileData = AllocatePool ((UINTN) Length); if (ReadFileInfo->FileData == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -941,7 +941,7 @@ ReadFile ( // // 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) { // @@ -951,7 +951,7 @@ ReadFile ( CopyMem ( ReadFileInfo->FileData, (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition), - ReadFileInfo->FileDataSize + (UINTN) ReadFileInfo->FileDataSize ); ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize; @@ -1099,7 +1099,7 @@ ReadFile ( DiskIo, BlockIo->Media->MediaId, Offset + MultU64x32 (Lsn, LogicalBlockSize), - DataLength, + (UINTN) DataLength, (VOID *)((UINT8 *)ReadFileInfo->FileData + DataOffset) ); -- 2.39.2