diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-11-08 10:44:01 -0600 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2019-11-18 14:06:15 +0000 |
commit | b466f78bc83ccfc85d5158c359e8aae9e19f70fe (patch) | |
tree | d0ea5d7e06438434a6bf7aa766ea4b2e9943e28b /extensions/openpower-pels | |
parent | 1299cbb4a9d056abefd5fdd3ebb1a545fc478b64 (diff) | |
download | phosphor-logging-b466f78bc83ccfc85d5158c359e8aae9e19f70fe.tar.gz phosphor-logging-b466f78bc83ccfc85d5158c359e8aae9e19f70fe.zip |
PEL: Pad UserData section to 4 byte boundary
The spec says that all section sizes must be a
multiple of 4 bytes, so pad the User Data section that
contains the AdditionalData JSON out to that.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I30b46a34604ee10d67755f51fd7d9c41b2f75c9f
Diffstat (limited to 'extensions/openpower-pels')
-rw-r--r-- | extensions/openpower-pels/pel.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp index 2345e0e..e006541 100644 --- a/extensions/openpower-pels/pel.cpp +++ b/extensions/openpower-pels/pel.cpp @@ -195,6 +195,12 @@ std::unique_ptr<UserData> makeADUserDataSection(const AdditionalData& ad) auto jsonString = json.dump(); std::vector<uint8_t> jsonData(jsonString.begin(), jsonString.end()); + // Pad to a 4 byte boundary + while ((jsonData.size() % 4) != 0) + { + jsonData.push_back(0); + } + return std::make_unique<UserData>( static_cast<uint16_t>(ComponentID::phosphorLogging), static_cast<uint8_t>(UserDataFormat::json), |