From: Star Zeng Date: Thu, 14 Sep 2017 10:52:22 +0000 (+0800) Subject: MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure X-Git-Tag: edk2-stable201903~3409 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=54537008a2f7d4e8a35507af8b523e7b678abacd MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure VS2010/VS2012 build failure with below info: warning C4701: potentially uninitialized local variable 'DataOffset' used potentially uninitialized local variable 'FilePosition' used potentially uninitialized local variable 'FinishedSeeking' used potentially uninitialized local variable 'Data' used warning C4703: potentially uninitialized local pointer variable 'Data' used In fact, DataOffset, FilePosition and FinishedSeeking are initialized and then used if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ). DoFreeAed will be set to TRUE when Data is allocated and returned from GetAedAdsData(), and Data will be freed if (DoFreeAed) when exiting. Use same method at 5afa5b815936e2b45a375b6521764195bed68680 to fix the build failure. There is related discussion at https://lists.01.org/pipermail/edk2-devel/2017-September/014641.html Cc: Laszlo Ersek Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Liming Gao Cc: Dandan Bi Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Paulo Alcantara --- diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 9ec81a6cdc..4609580b30 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -897,6 +897,10 @@ ReadFile ( // set BytesLeft to suppress incorrect compiler/analyzer warnings // BytesLeft = 0; + DataOffset = 0; + FilePosition = 0; + FinishedSeeking = FALSE; + Data = NULL; switch (ReadFileInfo->Flags) { case READ_FILE_GET_FILESIZE: