From owner-svn-src-all@freebsd.org Thu May 5 00:07:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEB91B2B718; Thu, 5 May 2016 00:07:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8D951FC0; Thu, 5 May 2016 00:07:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u450782U084225; Thu, 5 May 2016 00:07:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u45078bb084224; Thu, 5 May 2016 00:07:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201605050007.u45078bb084224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Thu, 5 May 2016 00:07:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299098 - head/sys/boot/efi/libefi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2016 00:07:10 -0000 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,