* [PATCH] SecurityPkg: Add NULL check of pointer variable before using it
@ 2019-01-31 9:28 Maggie Chu
0 siblings, 0 replies; only message in thread
From: Maggie Chu @ 2019-01-31 9:28 UTC (permalink / raw)
To: edk2-devel; +Cc: Chao Zhang, Jiewen Yao, Eric Dong
https://bugzilla.tianocore.org/show_bug.cgi?id=1503
A pointer variable should be checked if it is NULL or Valid before using it.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Maggie Chu <maggie.chu@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
---
SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
index 734c5f06ff..f79f9f7282 100644
--- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
@@ -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;
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-01-31 9:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-31 9:28 [PATCH] SecurityPkg: Add NULL check of pointer variable before using it Maggie Chu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox