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:
@@ -2,7 +2,7 @@
|
|||||||
Entrypoint of Opal UEFI Driver and contains all the logic to
|
Entrypoint of Opal UEFI Driver and contains all the logic to
|
||||||
register for new Opal device instances.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -436,6 +436,9 @@ BuildOpalDeviceInfoAta (
|
|||||||
|
|
||||||
DevInfoAta = AllocateZeroPool (DevInfoLengthAta);
|
DevInfoAta = AllocateZeroPool (DevInfoLengthAta);
|
||||||
ASSERT (DevInfoAta != NULL);
|
ASSERT (DevInfoAta != NULL);
|
||||||
|
if (DevInfoAta == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TempDevInfoAta = DevInfoAta;
|
TempDevInfoAta = DevInfoAta;
|
||||||
TmpDev = mOpalDriver.DeviceList;
|
TmpDev = mOpalDriver.DeviceList;
|
||||||
@@ -527,6 +530,9 @@ BuildOpalDeviceInfoNvme (
|
|||||||
|
|
||||||
DevInfoNvme = AllocateZeroPool (DevInfoLengthNvme);
|
DevInfoNvme = AllocateZeroPool (DevInfoLengthNvme);
|
||||||
ASSERT (DevInfoNvme != NULL);
|
ASSERT (DevInfoNvme != NULL);
|
||||||
|
if (DevInfoNvme == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TempDevInfoNvme = DevInfoNvme;
|
TempDevInfoNvme = DevInfoNvme;
|
||||||
TmpDev = mOpalDriver.DeviceList;
|
TmpDev = mOpalDriver.DeviceList;
|
||||||
|
Reference in New Issue
Block a user