]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/OpalPassword: Add NULL pointer check before using it
authorEric Dong <eric.dong@intel.com>
Thu, 14 Feb 2019 06:53:14 +0000 (14:53 +0800)
committerEric Dong <eric.dong@intel.com>
Thu, 14 Feb 2019 06:53:14 +0000 (14:53 +0800)
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>
SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c

index 734c5f06ff054fe35c1377c96d70784537d2c820..b5317d82b8c734d25691549d82e7e47e8400a097 100644 (file)
@@ -2,7 +2,7 @@
   Entrypoint of Opal UEFI Driver and contains all the logic to\r
   register for new Opal device instances.\r
 \r
-Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -436,6 +436,9 @@ BuildOpalDeviceInfoAta (
 \r
   DevInfoAta = AllocateZeroPool (DevInfoLengthAta);\r
   ASSERT (DevInfoAta != NULL);\r
+  if (DevInfoAta == NULL) {\r
+    return;\r
+  }\r
 \r
   TempDevInfoAta = DevInfoAta;\r
   TmpDev = mOpalDriver.DeviceList;\r
@@ -527,6 +530,9 @@ BuildOpalDeviceInfoNvme (
 \r
   DevInfoNvme = AllocateZeroPool (DevInfoLengthNvme);\r
   ASSERT (DevInfoNvme != NULL);\r
+  if (DevInfoNvme == NULL) {\r
+    return;\r
+  }\r
 \r
   TempDevInfoNvme = DevInfoNvme;\r
   TmpDev = mOpalDriver.DeviceList;\r