svn commit: r358157 - head/stand/efi/libefi

Toomas Soome tsoome at FreeBSD.org
Thu Feb 20 08:48:36 UTC 2020


Author: tsoome
Date: Thu Feb 20 08:48:34 2020
New Revision: 358157
URL: https://svnweb.freebsd.org/changeset/base/358157

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

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

Modified: head/stand/efi/libefi/efinet.c
==============================================================================
--- head/stand/efi/libefi/efinet.c	Thu Feb 20 07:12:43 2020	(r358156)
+++ head/stand/efi/libefi/efinet.c	Thu Feb 20 08:48:34 2020	(r358157)
@@ -371,6 +371,8 @@ efinet_dev_init()
 	status = BS->LocateHandle(ByProtocol, &sn_guid, NULL, &sz, NULL);
 	if (status == EFI_BUFFER_TOO_SMALL) {
 		handles = (EFI_HANDLE *)malloc(sz);
+		if (handles == NULL)
+			return (ENOMEM);
 		status = BS->LocateHandle(ByProtocol, &sn_guid, NULL, &sz,
 		    handles);
 		if (EFI_ERROR(status))


More information about the svn-src-head mailing list