diff options
author | Eric Dong <eric.dong@intel.com> | 2019-02-14 14:53:14 +0800 |
---|---|---|
committer | Eric Dong <eric.dong@intel.com> | 2019-02-14 14:53:14 +0800 |
commit | d72d8561fbe03a64e01c2ad57a93777de4b9ae2f (patch) | |
tree | 957503da077f6426f4ad3790a6b038ad49af1e76 | |
parent | 315873959ec3e0a44168efdf4c03fe6160121cdb (diff) | |
download | edk2-d72d8561fbe03a64e01c2ad57a93777de4b9ae2f.tar.gz edk2-d72d8561fbe03a64e01c2ad57a93777de4b9ae2f.tar.bz2 edk2-d72d8561fbe03a64e01c2ad57a93777de4b9ae2f.zip |
SecurityPkg/OpalPassword: Add NULL pointer check before using it
https://bugzilla.tianocore.org/show_bug.cgi?id=1503
A pointer variable should be checked if it is NULL or Valid before
using it.
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Maggie Chu <maggie.chu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
-rw-r--r-- | SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c index 734c5f06ff..b5317d82b8 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c @@ -2,7 +2,7 @@ Entrypoint of Opal UEFI Driver and contains all the logic to
register for new Opal device instances.
-Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -436,6 +436,9 @@ BuildOpalDeviceInfoAta ( DevInfoAta = AllocateZeroPool (DevInfoLengthAta);
ASSERT (DevInfoAta != NULL);
+ if (DevInfoAta == NULL) {
+ return;
+ }
TempDevInfoAta = DevInfoAta;
TmpDev = mOpalDriver.DeviceList;
@@ -527,6 +530,9 @@ BuildOpalDeviceInfoNvme ( DevInfoNvme = AllocateZeroPool (DevInfoLengthNvme);
ASSERT (DevInfoNvme != NULL);
+ if (DevInfoNvme == NULL) {
+ return;
+ }
TempDevInfoNvme = DevInfoNvme;
TmpDev = mOpalDriver.DeviceList;
|