diff options
| author | Mike Jones <mjjones@us.ibm.com> | 2013-06-06 11:35:21 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-06-11 15:22:40 -0500 |
| commit | 7f3380ff1ae809d664b33835267e9278e00d7700 (patch) | |
| tree | 39771061c148a8dd6f25f3069f3afc6868770687 /src/include/usr/hwpf | |
| parent | f03a35a49b91257b59bdad052db10e6f9a7e8685 (diff) | |
| download | blackbird-hostboot-7f3380ff1ae809d664b33835267e9278e00d7700.tar.gz blackbird-hostboot-7f3380ff1ae809d664b33835267e9278e00d7700.zip | |
HWPF: Compile time check for adding too much FFDC to ReturnCode
Change-Id: I2fd4382329a328d97ddf9f7e3faf39e9db95b67b
RTC: 72984
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/4870
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: Donald E. Dahle <dedahle@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr/hwpf')
| -rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCode.H | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H index 235de0206..2986412d3 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCode.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H @@ -47,6 +47,7 @@ * mjjones 09/19/2012 Add FFDC ID to error info * mjjones 03/22/2013 Support Procedure Callouts * mjjones 05/20/2013 Support Bus Callouts + * mjjones 06/06/2013 Check FFDC size at compile time */ #ifndef FAPIRETURNCODE_H_ @@ -471,9 +472,25 @@ namespace ReturnCodeFfdc { EI_FFDC_SIZE_ECMDDB = 0xffff, // ecmdDataBufferBase EI_FFDC_SIZE_TARGET = 0xfffe, // fapi::Target + EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb }; /** + * @brief Compile error if caller tries to add too much FFDC to a ReturnCode + * + * If the unspecialized function template is instantiated, the compile will + * fail due to the construction of an undefined class. If the specialized + * function template is instantiated (done if the FFDC size is not too big), + * the function does nothing and is optimized out + */ + class Error_FfdcTooLargeToCapture; + template<const bool TOO_BIG> void checkFfdcSize() + { + Error_FfdcTooLargeToCapture(); + } + template <> inline void checkFfdcSize<false>() {} + + /** * @brief Get FFDC Size * * This is called by the FAPI_SET_HWP_ERROR macro to find out the size of @@ -486,6 +503,7 @@ namespace ReturnCodeFfdc template<typename T> uint16_t getErrorInfoFfdcSize(const T &) { + checkFfdcSize<(sizeof(T) > EI_FFDC_MAX_SIZE)>(); return sizeof(T); } |

