summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2015-07-26 08:06:11 +0000
committerjljusten <jljusten@Edk2>2015-07-26 08:06:11 +0000
commit1999fb3180054c98a1bb2e7c9823106c4e1da83e (patch)
tree159eac14772a8a8e90fe67c928aec4027e6ea10a /IntelFrameworkModulePkg
parent245fe0618d0c8c2afaf8966de7cffb8de86bbf74 (diff)
downloadedk2-platforms-1999fb3180054c98a1bb2e7c9823106c4e1da83e.tar.xz
IntelFrameworkModulePkg: GenericBdsLib: set Status before use
The recent patch titled IntelFrameworkModulePkg/GenericBdsLib: remove AcpiS3->S3Save() call has exposed a preexistent bug in the BdsLibBootViaBootOption() function, and now the IA32 build of OVMF fails with: In function 'BdsLibBootViaBootOption': error: 'Status' may be used uninitialized in this function Namely, we have the following (simplified) data flow: // // Status and ImageHandle both start out uninitialized // /* ... */ ImageHandle = BdsExpandUsbShortFormDevicePath (DevicePath); /* ... */ if (ImageHandle == NULL) { /* ... */ } if ((ImageHandle == NULL) || (EFI_ERROR(Status))) { /* ... */ */ If BdsExpandUsbShortFormDevicePath() returns a non-NULL value, then the second "if" statement will check Status without the function having initialized or assigned it. When BdsExpandUsbShortFormDevicePath() returns non-NULL, Status should be EFI_SUCCESS; so let us assign it that value up-front. Note that the bug existed before the patch IntelFrameworkModulePkg/GenericBdsLib: remove AcpiS3->S3Save() call That is, the bug was not introduced, only exposed, by the patch -- in the pre-patch state, although the Status variable was set early and unconditionally, the error code that it may have carried from the failed gEfiAcpiS3SaveProtocolGuid lookup had nothing to do with the second "if" statement above. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jeff Fan <jeff.fan@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18061 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 4b7eca7bbd..68b32f32f0 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -2236,6 +2236,7 @@ BdsLibBootViaBootOption (
LIST_ENTRY TempBootLists;
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
+ Status = EFI_SUCCESS;
*ExitDataSize = 0;
*ExitData = NULL;