summaryrefslogtreecommitdiff
path: root/SecurityPkg
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2016-04-06 12:52:44 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-04 10:33:35 +0800
commitf91689dd260c1c5bdca55ee838801e45ae474393 (patch)
tree7e688e3efca54fcd8d1ac43243ac63c24caf71f2 /SecurityPkg
parent30c736ae54f9420298ffaab5e34a896a8131af20 (diff)
downloadedk2-platforms-f91689dd260c1c5bdca55ee838801e45ae474393.tar.xz
SecurityPkg OpalPasswordDxe: Check the pointer before use it.
Check the pointer before use it to make the code more safely. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> (cherry picked from commit b4ddf0eb49f7ee41c075b69ed69557f8fa3d5b85)
Diffstat (limited to 'SecurityPkg')
-rw-r--r--SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
index 250cb438e9..eb7d59b52c 100644
--- a/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
+++ b/SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalHii.c
@@ -435,12 +435,12 @@ GetDiskNameStringId(
EFI_STATUS
EFIAPI
DriverCallback(
- CONST EFI_HII_CONFIG_ACCESS_PROTOCOL* This,
+ CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
EFI_BROWSER_ACTION Action,
EFI_QUESTION_ID QuestionId,
UINT8 Type,
- EFI_IFR_TYPE_VALUE* Value,
- EFI_BROWSER_ACTION_REQUEST* ActionRequest
+ EFI_IFR_TYPE_VALUE *Value,
+ EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
HII_KEY HiiKey;
@@ -448,6 +448,8 @@ DriverCallback(
if (ActionRequest != NULL) {
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+ } else {
+ return EFI_INVALID_PARAMETER;
}
//
@@ -644,14 +646,13 @@ HiiPsidRevert(
UnicodeStrToAsciiStr(gHiiConfiguration.Psid, (CHAR8*)Psid.Psid);
- OpalDisk = HiiGetOpalDiskCB(gHiiConfiguration.SelectedDiskIndex);
-
- ZeroMem(&Session, sizeof(Session));
- Session.Sscp = OpalDisk->Sscp;
- Session.MediaId = OpalDisk->MediaId;
- Session.OpalBaseComId = OpalDisk->OpalBaseComId;
-
+ OpalDisk = HiiGetOpalDiskCB (gHiiConfiguration.SelectedDiskIndex);
if (OpalDisk != NULL) {
+ ZeroMem(&Session, sizeof(Session));
+ Session.Sscp = OpalDisk->Sscp;
+ Session.MediaId = OpalDisk->MediaId;
+ Session.OpalBaseComId = OpalDisk->OpalBaseComId;
+
Ret = OpalSupportPsidRevert(&Session, Psid.Psid, (UINT32)sizeof(Psid.Psid), OpalDisk->OpalDevicePath);
}