[edk2-devel] [PATCH EDK2 v2 1/1] OvmfPkg/XenPvBlkDxe: add return value if allocting fail

wenyi,xie via groups.io xiewenyi2=huawei.com at groups.io
Tue Nov 24 02:06:32 UTC 2020


return EFI_OUT_OF_RESOURCES if pool allocating fail.

Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Laszlo Ersek <lersek at redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
Cc: Anthony Perard <anthony.perard at citrix.com>
Cc: Julien Grall <julien at xen.org>
Signed-off-by: Wenyi Xie <xiewenyi2 at huawei.com>
---
 OvmfPkg/XenPvBlkDxe/BlockFront.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c
index 122a6baed25a..32d70c36cef2 100644
--- a/OvmfPkg/XenPvBlkDxe/BlockFront.c
+++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c
@@ -155,6 +155,10 @@ XenPvBlockFrontInitialization (
   ASSERT (NodeName != NULL);
 
   Dev = AllocateZeroPool (sizeof (XEN_BLOCK_FRONT_DEVICE));
+  if (Dev == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+
   Dev->Signature = XEN_BLOCK_FRONT_SIGNATURE;
   Dev->NodeName = NodeName;
   Dev->XenBusIo = XenBusIo;
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67863): https://edk2.groups.io/g/devel/message/67863
Mute This Topic: https://groups.io/mt/78469250/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list