git: 8b18746cb1bd - stable/12 - connect_controllers() is missing NULL pointer check

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 01:16:32 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=8b18746cb1bdfc89e831a023dd3dcb04c6f9e439

commit 8b18746cb1bdfc89e831a023dd3dcb04c6f9e439
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-02-20 08:55:18 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:58 +0000

    connect_controllers() is missing NULL pointer check
    
    Add missing check of malloc() result.
    
    (cherry picked from commit ef91a071ac534ed1293f624e4e205916da8f30a4)
---
 stand/efi/libefi/efi_driver_utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/stand/efi/libefi/efi_driver_utils.c b/stand/efi/libefi/efi_driver_utils.c
index 0edea5c1e0d8..e5034c2e34d6 100644
--- a/stand/efi/libefi/efi_driver_utils.c
+++ b/stand/efi/libefi/efi_driver_utils.c
@@ -52,6 +52,8 @@ connect_controllers(EFI_GUID *filter)
         }
 
         handles = malloc(hsize);
+	if (handles == NULL)
+		return (EFI_OUT_OF_RESOURCES);
         nhandles = hsize / sizeof(EFI_HANDLE);
 
         status = BS->LocateHandle(ByProtocol, filter, NULL,