Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2020 09:03:00 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358163 - head/stand/efi/libefi
Message-ID:  <202002200903.01K930EF061458@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Thu Feb 20 09:02:59 2020
New Revision: 358163
URL: https://svnweb.freebsd.org/changeset/base/358163

Log:
  efi_register_handles() is missing NULL pointer check
  
  Add missing check of malloc() result.

Modified:
  head/stand/efi/libefi/handles.c

Modified: head/stand/efi/libefi/handles.c
==============================================================================
--- head/stand/efi/libefi/handles.c	Thu Feb 20 09:00:20 2020	(r358162)
+++ head/stand/efi/libefi/handles.c	Thu Feb 20 09:02:59 2020	(r358163)
@@ -52,6 +52,8 @@ efi_register_handles(struct devsw *sw, EFI_HANDLE *han
 	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?202002200903.01K930EF061458>