]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
SecurityPkg/OpalPassword: Add NULL pointer check before using it
[mirror_edk2.git] / 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