diff options
author | Richard J. Knight <rjknight@us.ibm.com> | 2016-06-15 12:48:35 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-06-22 14:17:54 -0400 |
commit | de4ae93cc155e9a6ffb78cddf3918a20fd926afd (patch) | |
tree | a2ee19826276df187c85dd64a32ac3604bc3d507 | |
parent | 0e4b0eae6b7ee6482269bf8a86460ff55647fdbe (diff) | |
download | talos-hostboot-de4ae93cc155e9a6ffb78cddf3918a20fd926afd.tar.gz talos-hostboot-de4ae93cc155e9a6ffb78cddf3918a20fd926afd.zip |
Variable buffer issues when inserting OT variable buffer
-Added check for integral_type for OT insert.
This change forces the user to insert only integral
types using the generic insert interface.
Change-Id: Ic207f855afff5e80d6bb342f94873964a0f60d16
RTC:151788
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25861
Tested-by: Jenkins Server
Tested-by: PPE CI
Reviewed-by: Soma Bhanutej <soma.bhanu@in.ibm.com>
Reviewed-by: Joachim Fenkes <fenkes@de.ibm.com>
Tested-by: Hostboot CI
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25869
Tested-by: FSP CI Jenkins
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/import/hwpf/fapi2/include/variable_buffer.H | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/import/hwpf/fapi2/include/variable_buffer.H b/src/import/hwpf/fapi2/include/variable_buffer.H index 227ffc526..9bf9294e7 100644 --- a/src/import/hwpf/fapi2/include/variable_buffer.H +++ b/src/import/hwpf/fapi2/include/variable_buffer.H @@ -167,9 +167,9 @@ inline fapi2::ReturnCodes _insert(const unit_type* i_source, /// @note Variable buffers are not (presently) declared as std::bitset /// as bitsets' size is fixed at runtime. It is not clear if this is /// acceptable for variable_buffers at this time. -/// @note Variable buffers are implemented as a std::vecor of uint32_t +/// @note Variable buffers are implemented as a std::vector of uint32_t /// as this keeps simple compatibility with ecmdDataBuffers. Cronus (at -//least) need to interwork the two. +// least) needs to interwork the two. class variable_buffer { @@ -788,7 +788,7 @@ class variable_buffer /// @param[in] i_targetStart The position in this where the copy starts /// @param[in] i_len How many bits to copy /// @param[in] i_sourceStart The start positon in i_data, defaults to 0 - /// @return FAPI2_RC_SUCCESS on success, FAPi2_RC_OVERFLOW otherwise + /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise /// template<typename OT> inline fapi2::ReturnCodes insert(const OT& i_data, @@ -796,6 +796,10 @@ class variable_buffer bits_type i_len = ~0, bits_type i_sourceStart = 0) { + // Compile time check to make sure OT is integral + static_assert( std::is_integral<OT>::value, + "Input must be an integral type" ); + // _insert likes 32-bit sources. So lets make our source 32 bits. uint32_t l_source = static_cast<uint32_t>(i_data); bits_type l_sourceStart = i_sourceStart + @@ -1007,7 +1011,7 @@ inline fapi2::ReturnCodes variable_buffer::insert(const uint64_t& i_source, i_sourceStart, i_targetStart, i_len); } -// Insert another variable_bufer +// Insert another variable_buffer template<> inline fapi2::ReturnCodes variable_buffer::insert( const variable_buffer& i_data, |