From: "Zeng, Star" <star.zeng@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
"Dong, Eric" <eric.dong@intel.com>,
Paulo Alcantara <pcacjr@zytor.com>,
"Ni, Ruiyu" <ruiyu.ni@intel.com>,
"Gao, Liming" <liming.gao@intel.com>,
"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile()
Date: Wed, 13 Sep 2017 06:43:51 +0000 [thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9409E7@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B94098B@shsmsx102.ccr.corp.intel.com>
Beyond the Rb (I do not want to block this patch series), I am curious about one question.
There may be more this kind of workarounds to fix the build failure.
Is it possible to disable the warning (like below example for VS) for specific version of GCC for this kind of false alarm?
ProcessorBind.h:
#if defined(_MSC_EXTENSIONS)
...
#if _MSC_VER == 1800 || _MSC_VER == 1900
//
// Disable these warnings for VS2013.
//
//
// This warning is for potentially uninitialized local variable, and it may cause false
// positive issues in VS2013 and VS2015 build
//
#pragma warning ( disable : 4701 )
//
// This warning is for potentially uninitialized local pointer variable, and it may cause
// false positive issues in VS2013 and VS2015 build
//
#pragma warning ( disable : 4703 )
#endif
#endif
Thanks,
Star
-----Original Message-----
From: Zeng, Star
Sent: Wednesday, September 13, 2017 2:34 PM
To: Laszlo Ersek <lersek@redhat.com>; edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Dong, Eric <eric.dong@intel.com>; Paulo Alcantara <pcacjr@zytor.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile()
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Laszlo Ersek [mailto:lersek@redhat.com]
Sent: Wednesday, September 13, 2017 6:26 AM
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Dong, Eric <eric.dong@intel.com>; Paulo Alcantara <pcacjr@zytor.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile()
When building the driver for DEBUG/RELEASE, GCC48/GCC49 warn about
ReadFile() possibly using "BytesLeft" without initializing it first.
This is not the case. The reads of "BytesLeft" are only reachable if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ). But, in that case, we also set "BytesLeft" to "ReadFileInfo->FileDataSize", near the top of the function.
Assign "BytesLeft" zero at the top, and add a comment that conforms to the pending Coding Style Spec feature request at <https://bugzilla.tianocore.org/show_bug.cgi?id=607>.
This issue was reported by Ard's and Gerd's CI systems independently.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
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>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
index 096fbb4452cb..392494b2eb3f 100644
--- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
+++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
@@ -893,6 +893,11 @@ ReadFile (
LogicalBlockSize = LV_BLOCK_SIZE (Volume, UDF_DEFAULT_LV_NUM);
DoFreeAed = FALSE;
+ //
+ // set BytesLeft to suppress incorrect compiler/analyzer warnings //
+ BytesLeft = 0;
+
switch (ReadFileInfo->Flags) {
case READ_FILE_GET_FILESIZE:
case READ_FILE_ALLOCATE_AND_READ:
--
2.14.1.3.gb7cf6e02401b
next prev parent reply other threads:[~2017-09-13 6:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 22:26 [PATCH 0/2] MdeModulePkg: UDF fixes and cleanups, round 2 Laszlo Ersek
2017-09-12 22:26 ` [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in ICB.Flags[2:0] Laszlo Ersek
2017-09-13 2:26 ` Ni, Ruiyu
2017-09-13 6:35 ` Zeng, Star
2017-09-12 22:26 ` [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile() Laszlo Ersek
2017-09-13 6:33 ` Zeng, Star
2017-09-13 6:43 ` Zeng, Star [this message]
2017-09-13 18:49 ` Laszlo Ersek
2017-09-13 18:52 ` Ard Biesheuvel
2017-09-14 0:42 ` Zeng, Star
2017-09-14 1:20 ` Zeng, Star
2017-09-14 1:30 ` Gao, Liming
2017-09-14 8:19 ` Laszlo Ersek
2017-09-14 8:53 ` Zeng, Star
2017-09-14 8:17 ` Laszlo Ersek
2017-09-14 8:50 ` Zeng, Star
2017-09-14 9:01 ` Laszlo Ersek
2017-09-13 13:42 ` [PATCH 0/2] MdeModulePkg: UDF fixes and cleanups, round 2 Paulo Alcantara
2017-09-13 22:08 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0C09AFA07DD0434D9E2A0C6AEB0483103B9409E7@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox