diff options
author | cem <cem@FreeBSD.org> | 2016-05-05 00:07:08 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2016-05-05 00:07:08 +0000 |
commit | 3b02df6fd3bb6f1f89429eb1a6c6a21cb14a595d (patch) | |
tree | 1a5944df6337db33e5d327d10a0319a6d54b293e /sys/boot/efi | |
parent | 1927244465ddc89990ecaa8bff88966f12bbf7dd (diff) | |
download | FreeBSD-src-3b02df6fd3bb6f1f89429eb1a6c6a21cb14a595d.zip FreeBSD-src-3b02df6fd3bb6f1f89429eb1a6c6a21cb14a595d.tar.gz |
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
Diffstat (limited to 'sys/boot/efi')
-rw-r--r-- | sys/boot/efi/libefi/efipart.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c index da420bf..410057c 100644 --- a/sys/boot/efi/libefi/efipart.c +++ b/sys/boot/efi/libefi/efipart.c @@ -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, |