Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 2021 01:16:33 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9e05a1578650 - stable/12 - efipart_inithandles() is missing NULL pointer check
Message-ID:  <202110080116.1981GXqj010716@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e05a157865009dc23e93753cfa09efd7bbbd738

commit 9e05a157865009dc23e93753cfa09efd7bbbd738
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-02-20 08:56:56 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:59 +0000

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

diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c
index 0710a33fdf93..424df7d2e423 100644
--- a/stand/efi/libefi/efipart.c
+++ b/stand/efi/libefi/efipart.c
@@ -363,6 +363,8 @@ efipart_inithandles(void)
 	status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, hin);
 	if (status == EFI_BUFFER_TOO_SMALL) {
 		hin = malloc(sz);
+		if (hin == NULL)
+			return (ENOMEM);
 		status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz,
 		    hin);
 		if (EFI_ERROR(status))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110080116.1981GXqj010716>