From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 4858820945C16 for ; Thu, 14 Sep 2017 03:50:52 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 14 Sep 2017 03:53:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,392,1500966000"; d="scan'208";a="151765277" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.31]) by fmsmga006.fm.intel.com with ESMTP; 14 Sep 2017 03:53:49 -0700 From: Star Zeng To: edk2-devel@lists.01.org Cc: Star Zeng , Laszlo Ersek , Eric Dong , Paulo Alcantara , Ruiyu Ni , Liming Gao , Dandan Bi Date: Thu, 14 Sep 2017 18:53:47 +0800 Message-Id: <1505386427-9048-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure 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: Thu, 14 Sep 2017 10:50:52 -0000 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 --- MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 9ec81a6cdcb4..4609580b3016 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: -- 2.7.0.windows.1