Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2016 00:07:08 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299098 - head/sys/boot/efi/libefi
Message-ID:  <201605050007.u45078bb084224@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Thu May  5 00:07:08 2016
New Revision: 299098
URL: https://svnweb.freebsd.org/changeset/base/299098

Log:
  efipart: Support an arbitrary number of partitions
  
  Don't crash if the user has more than 31 of them.  A follow-up to
  r298230.
  
  Reviewed by:	allanjude
  Relnotes:	maybe
  Sponsored by:	EMC / Isilon Storage Division
  Differential Revision:	https://reviews.freebsd.org/D6212

Modified:
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/efipart.c
==============================================================================
--- head/sys/boot/efi/libefi/efipart.c	Wed May  4 23:38:27 2016	(r299097)
+++ head/sys/boot/efi/libefi/efipart.c	Thu May  5 00:07:08 2016	(r299098)
@@ -65,14 +65,12 @@ struct devsw efipart_dev = {
 /*
  * info structure to support bcache
  */
-#define	MAXPDDEV	31	/* see MAXDEV in libi386.h */
-
-static struct pdinfo
-{
+struct pdinfo {
 	int	pd_unit;	/* unit number */
 	int	pd_open;	/* reference counter */
 	void	*pd_bcache;	/* buffer cache data */
-} pdinfo [MAXPDDEV];
+};
+static struct pdinfo *pdinfo;
 static int npdinfo = 0;
 
 #define PD(dev)         (pdinfo[(dev)->d_unit])
@@ -109,6 +107,9 @@ efipart_init(void) 
 	nout = 0;
 
 	bzero(aliases, nin * sizeof(EFI_HANDLE));
+	pdinfo = malloc(nin * sizeof(*pdinfo));
+	if (pdinfo == NULL)
+		return (ENOMEM);
 
 	for (n = 0; n < nin; n++) {
 		status = BS->HandleProtocol(hin[n], &devpath_guid,



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