From 3d2d379ce4783d2214af2c7a341831ce3b9fd3cf Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 24 Jan 2002 23:35:56 +0000 Subject: [PATCH] Have a pe_total check using theoretically big number instead of the unnecessarily small limit LVM1 imposes in vgcreate (but not vgextend) --- lib/format1/disk-rep.h | 2 ++ lib/format1/layout.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/format1/disk-rep.h b/lib/format1/disk-rep.h index 7072c963e..958598cb3 100644 --- a/lib/format1/disk-rep.h +++ b/lib/format1/disk-rep.h @@ -22,6 +22,8 @@ #define MAX_PE_SIZE ( 16L * 1024L * 1024L / SECTOR_SIZE * 1024) #define PE_SIZE_PV_SIZE_REL 5 /* PV size must be at least 5 times PE size */ #define MAX_LE_TOTAL ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2) +#define MAX_PE_TOTAL ( ( uint32_t) (-2) ) + #define UNMAPPED_EXTENT 0 diff --git a/lib/format1/layout.c b/lib/format1/layout.c index 323f71972..5e0f00fce 100644 --- a/lib/format1/layout.c +++ b/lib/format1/layout.c @@ -147,6 +147,14 @@ int calculate_extent_count(struct physical_volume *pv) } while((pvd->pe_start + (pvd->pe_total * pv->pe_size)) > pv->size); + if (pvd->pe_total > MAX_PE_TOTAL) { + log_error("Metadata extent limit (%u) exceeded for %s - " + "%u required", MAX_PE_TOTAL, dev_name(pv->dev), + pvd->pe_total); + dbg_free(pvd); + return 0; + } + pv->pe_count = pvd->pe_total; pv->pe_start = pvd->pe_start; dbg_free(pvd); -- 2.43.5