Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 2021 01:16:36 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: 91da922301a2 - stable/12 - efi_register_handles() is missing NULL pointer check
Message-ID:  <202110080116.1981GaSg010764@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=91da922301a27520671a4a4a83389fc46ad3bb8a

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

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

diff --git a/stand/efi/libefi/handles.c b/stand/efi/libefi/handles.c
index 1e4ef6ffbd50..a55239dbec8c 100644
--- a/stand/efi/libefi/handles.c
+++ b/stand/efi/libefi/handles.c
@@ -52,6 +52,8 @@ efi_register_handles(struct devsw *sw, EFI_HANDLE *handles,
 	nentries += count;
 	sz = nentries * sizeof(struct entry);
 	entry = (entry == NULL) ? malloc(sz) : realloc(entry, sz);
+	if (entry == NULL)
+		return (ENOMEM);
 	for (unit = 0; idx < nentries; idx++, unit++) {
 		entry[idx].handle = handles[unit];
 		if (aliases != NULL)



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