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 <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
{\r
*NewFileIdentifierDesc =\r
(UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool (\r
{\r
*NewFileIdentifierDesc =\r
(UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool (\r
- GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc);\r
+ (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc);\r
//\r
// Allocate buffer to read in AED's data.\r
//\r
//\r
// Allocate buffer to read in AED's data.\r
//\r
- *Data = AllocatePool (*Length);\r
+ *Data = AllocatePool ((UINTN) (*Length));\r
if (*Data == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
if (*Data == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
DiskIo,\r
BlockIo->Media->MediaId,\r
Offset,\r
DiskIo,\r
BlockIo->Media->MediaId,\r
Offset,\r
return EFI_OUT_OF_RESOURCES;\r
}\r
} else {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
} else {\r
- *Buffer = ReallocatePool (Length, Length + ExtentLength, *Buffer);\r
+ *Buffer = ReallocatePool ((UINTN) Length, (UINTN) (Length + ExtentLength), *Buffer);\r
if (*Buffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
if (*Buffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
//\r
// Allocate buffer for starting read data.\r
//\r
//\r
// Allocate buffer for starting read data.\r
//\r
- ReadFileInfo->FileData = AllocatePool (Length);\r
+ ReadFileInfo->FileData = AllocatePool ((UINTN) Length);\r
if (ReadFileInfo->FileData == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
if (ReadFileInfo->FileData == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
//\r
// Read all inline data into ReadFileInfo->FileData\r
//\r
//\r
// Read all inline data into ReadFileInfo->FileData\r
//\r
- CopyMem (ReadFileInfo->FileData, Data, Length);\r
+ CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length);\r
ReadFileInfo->ReadLength = Length;\r
} else if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ) {\r
//\r
ReadFileInfo->ReadLength = Length;\r
} else if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ) {\r
//\r
CopyMem (\r
ReadFileInfo->FileData,\r
(VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition),\r
CopyMem (\r
ReadFileInfo->FileData,\r
(VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition),\r
- ReadFileInfo->FileDataSize\r
+ (UINTN) ReadFileInfo->FileDataSize\r
);\r
\r
ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;\r
);\r
\r
ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;\r
DiskIo,\r
BlockIo->Media->MediaId,\r
Offset + MultU64x32 (Lsn, LogicalBlockSize),\r
DiskIo,\r
BlockIo->Media->MediaId,\r
Offset + MultU64x32 (Lsn, LogicalBlockSize),\r
(VOID *)((UINT8 *)ReadFileInfo->FileData +\r
DataOffset)\r
);\r
(VOID *)((UINT8 *)ReadFileInfo->FileData +\r
DataOffset)\r
);\r