summaryrefslogtreecommitdiffstats
path: root/src/sbefw/sbeSpMsg.H
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbefw/sbeSpMsg.H')
-rw-r--r--src/sbefw/sbeSpMsg.H4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sbefw/sbeSpMsg.H b/src/sbefw/sbeSpMsg.H
index 341a9122..0e695dd5 100644
--- a/src/sbefw/sbeSpMsg.H
+++ b/src/sbefw/sbeSpMsg.H
@@ -464,7 +464,9 @@ typedef struct
*/
uint64_t getDataLenCacheAlign() const
{
- uint64_t l_len = (len / 8);
+ // Expected length in bytes is 1, 2, 4, or multiples of 8,
+ // won't work for any other values
+ uint64_t l_len = (len < 8) ? (1) : (len / 8);
if(flags & SBE_MEM_ACCESS_FLAGS_TARGET_PBA)
{
l_len = (l_len / 16);
OpenPOWER on IntegriCloud