summaryrefslogtreecommitdiffstats
path: root/pnor_partition_table.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pnor_partition_table.cpp')
-rw-r--r--pnor_partition_table.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index 67b32f1..c9d56a2 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -99,6 +99,31 @@ void Table::preparePartitions()
parseTocLine(line, blockSize, part);
+ if (numParts > 0)
+ {
+ struct pnor_partition& prev = table.partitions[numParts - 1];
+ uint32_t prev_end = prev.data.base + prev.data.size;
+
+ if (part.data.id == prev.data.id)
+ {
+ MSG_ERR("ID for previous partition '%s' at block 0x%" PRIx32
+ "matches current partition '%s' at block 0x%" PRIx32
+ ": %" PRId32 "\n",
+ prev.data.name, prev.data.base, part.data.name,
+ part.data.base, part.data.id);
+ }
+
+ if (part.data.base < prev_end)
+ {
+ std::stringstream err;
+ err << "Partition '" << part.data.name << "' start block 0x"
+ << std::hex << part.data.base << "is less than the end "
+ << "block 0x" << std::hex << prev_end << " of '"
+ << prev.data.name << "'";
+ throw InvalidTocEntry(err.str());
+ }
+ }
+
file = directory / part.data.name;
if (!fs::exists(file))
{
OpenPOWER on IntegriCloud