diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2018-01-31 20:39:20 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@in.ibm.com> | 2018-02-13 10:59:45 +0530 |
commit | 2848d604715df6eb9f7f943b6a5d97ec3d7fddb7 (patch) | |
tree | 1215df725103426b34aa5321971a1d35157df1d8 | |
parent | e0cc8553ece4bf0c0db740b4b81bac2c6c46a708 (diff) | |
download | phosphor-host-ipmid-2848d604715df6eb9f7f943b6a5d97ec3d7fddb7.tar.gz phosphor-host-ipmid-2848d604715df6eb9f7f943b6a5d97ec3d7fddb7.zip |
FRU: Fix response for Read FRU Data Command
1) Add the count field as part of read fru command response.
2) Fix in copying the data from the offset.
Change-Id: I2eaa76e82179ad65ba3af0f1795aeec40e68a0fc
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
-rw-r--r-- | storagehandler.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/storagehandler.cpp b/storagehandler.cpp index 9052b6f..6ae2f91 100644 --- a/storagehandler.cpp +++ b/storagehandler.cpp @@ -651,9 +651,17 @@ ipmi_ret_t ipmi_storage_read_fru_data( entry("SIZE_OF_FRU_AREA=%s", size)); return IPMI_CC_INVALID; } - std::copy((fruArea.begin() + offset), (fruArea.begin() + reqptr->count), - (static_cast<uint8_t*>(response))); - *data_len = reqptr->count; + + // Write the count of requested data. + auto buff = static_cast<uint8_t *>(response); + *buff = reqptr->count; + buff++; + + std::copy((fruArea.begin() + offset), + (fruArea.begin() + offset + reqptr->count), + buff); + + *data_len = reqptr->count + 1; // additional one byte for count } catch (const InternalFailure& e) { |