public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure
@ 2017-09-14 10:53 Star Zeng
  2017-09-14 14:25 ` Paulo Alcantara
  0 siblings, 1 reply; 3+ messages in thread
From: Star Zeng @ 2017-09-14 10:53 UTC (permalink / raw)
  To: edk2-devel
  Cc: Star Zeng, Laszlo Ersek, Eric Dong, Paulo Alcantara, Ruiyu Ni,
	Liming Gao, Dandan Bi

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 <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure
  2017-09-14 10:53 [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure Star Zeng
@ 2017-09-14 14:25 ` Paulo Alcantara
  2017-09-15  1:40   ` Zeng, Star
  0 siblings, 1 reply; 3+ messages in thread
From: Paulo Alcantara @ 2017-09-14 14:25 UTC (permalink / raw)
  To: Star Zeng, edk2-devel
  Cc: Laszlo Ersek, Eric Dong, Ruiyu Ni, Liming Gao, Dandan Bi

Hi,

On 9/14/2017 7:53 AM, Star Zeng wrote:
> 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 <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Paulo Alcantara <pcacjr@zytor.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>   MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 4 ++++
>   1 file changed, 4 insertions(+)

With your patch, NT32 X64 build passes with VS2012. Thanks!

Reviewed-by: Paulo Alcantara <paulo@hp.com>

Paulo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure
  2017-09-14 14:25 ` Paulo Alcantara
@ 2017-09-15  1:40   ` Zeng, Star
  0 siblings, 0 replies; 3+ messages in thread
From: Zeng, Star @ 2017-09-15  1:40 UTC (permalink / raw)
  To: Paulo Alcantara, edk2-devel@lists.01.org
  Cc: Laszlo Ersek, Dong, Eric, Ni, Ruiyu, Gao, Liming, Bi, Dandan,
	Zeng, Star

Thanks. Patch is pushed at 54537008a2f7d4e8a35507af8b523e7b678abacd.


Star
-----Original Message-----
From: Paulo Alcantara [mailto:pcacjr@zytor.com] 
Sent: Thursday, September 14, 2017 10:25 PM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: Laszlo Ersek <lersek@redhat.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Gao, Liming <liming.gao@intel.com>; Bi, Dandan <dandan.bi@intel.com>
Subject: Re: [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure

Hi,

On 9/14/2017 7:53 AM, Star Zeng wrote:
> 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 <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Paulo Alcantara <pcacjr@zytor.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>   MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 4 ++++
>   1 file changed, 4 insertions(+)

With your patch, NT32 X64 build passes with VS2012. Thanks!

Reviewed-by: Paulo Alcantara <paulo@hp.com>

Paulo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-15  1:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 10:53 [PATCH] MdeModulePkg UdfDxe: Fix VS2010/VS2012 build failure Star Zeng
2017-09-14 14:25 ` Paulo Alcantara
2017-09-15  1:40   ` Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox