From d5b2f439a1a36938b4f7659bc7c40870db928c4a Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Wed, 13 Mar 2019 17:38:14 +0800
Subject: [PATCH 03/19] metadata: remove an unused and incorrect overflow check

Remove another instance of an invalid check for metadata
overflow during read.  The previous instance was removed
in commit 5fb15b193.

This was checking for metadata that that overflowed the
circular disk metadata buffer during read, but such metadata
cannot be written, so it shouldn't be possible to find see.
Also, the check was incorrect and could trigger when there
was no overflow.
---
 lib/format_text/format-text.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 4160ba8..4e5b08e 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -553,14 +553,6 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
 	if (rlocn->offset + rlocn->size > mdah->size)
 		wrap = (uint32_t) ((rlocn->offset + rlocn->size) - mdah->size);
 
-	if (wrap > rlocn->offset) {
-		log_error("Metadata for VG %s on %s at %llu size %llu is too large for circular buffer.",
-			  vgname, dev_name(area->dev),
-			  (unsigned long long)(area->start + rlocn->offset),
-			  (unsigned long long)rlocn->size);
-		goto out;
-	}
-
 	vg = text_read_metadata(fid, NULL, vg_fmtdata, use_previous_vg, area->dev, primary_mda,
 				(off_t) (area->start + rlocn->offset),
 				(uint32_t) (rlocn->size - wrap),
@@ -1249,13 +1241,6 @@ int read_metadata_location_summary(const struct format_type *fmt,
 	if (rlocn->offset + rlocn->size > mdah->size)
 		wrap = (uint32_t) ((rlocn->offset + rlocn->size) - mdah->size);
 
-	if (wrap > rlocn->offset) {
-		log_error("Metadata location on %s at %llu is too large for circular buffer.",
-			  dev_name(dev_area->dev),
-			  (unsigned long long)(dev_area->start + rlocn->offset));
-		return 0;
-	}
-
 	/*
 	 * Did we see this metadata before?
 	 * Look in lvmcache to see if there is vg info matching
-- 
2.19.1

