summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayanth Othayoth <ojayanth@in.ibm.com>2017-10-27 00:45:53 -0500
committerJayanth Othayoth <ojayanth@in.ibm.com>2017-10-31 01:31:03 -0500
commit59ce099b7b59e86f2cc8ffedd3c97143dfccd33c (patch)
tree645f092327fbcf656573bf31de8ff53701be80dc
parent8493c33b1adbaf0adaa6bf2b7c1696e86a89ab1b (diff)
downloadphosphor-mboxd-59ce099b7b59e86f2cc8ffedd3c97143dfccd33c.tar.gz
phosphor-mboxd-59ce099b7b59e86f2cc8ffedd3c97143dfccd33c.zip
Fix for mboxd segfault during flash read
mboxd segfaults during flash read when there is no partition associated to the given offset within the flash size. Proposed fix is to generate elog instead of returning reference to zeroed out pnor_partition structure. Resolves openbmc/openbmc#2365 Change-Id: I98bed1c09588c386d9ea2510618bb27eaa6dfbe0 Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
-rw-r--r--pnor_partition_table.cpp3
-rw-r--r--pnor_partition_table.hpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index 71510a2..aa68750 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -218,6 +218,9 @@ const pnor_partition& Table::partition(size_t offset) const
}
}
+ MSG_ERR("Partition corresponding to offset %x not found", offset);
+ elog<InternalFailure>();
+
static pnor_partition p{};
return p;
}
diff --git a/pnor_partition_table.hpp b/pnor_partition_table.hpp
index 662fb76..1cabe23 100644
--- a/pnor_partition_table.hpp
+++ b/pnor_partition_table.hpp
@@ -134,8 +134,8 @@ class Table
*
* @param[in] offset - PNOR offset in bytes
*
- * @returns const reference to pnor_partition, if found, else a
- * reference to a zeroed out pnor_partition structure.
+ * @returns const reference to pnor_partition, if found, else an
+ * exception will be thrown.
*/
const pnor_partition& partition(size_t offset) const;
OpenPOWER on IntegriCloud