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>
This commit is contained in:
Eric Dong 2019-02-14 14:53:14 +08:00
parent 315873959e
commit d72d8561fb
1 changed files with 7 additions and 1 deletions

View File

@ -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;