Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2020 08:48:34 +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: r358157 - head/stand/efi/libefi
Message-ID:  <202002200848.01K8mYQ4049388@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))



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