diff options
author | Bill Fischofer <bill.fischofer@linaro.org> | 2015-06-25 16:48:11 -0500 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-07-01 14:45:16 +0300 |
commit | 828f2e54799dd6f0f277aa125fbb325f48da9362 (patch) | |
tree | c99647cb5b65333f2c8f0e98a72d833e22d4c455 /platform/linux-generic/include/odp_buffer_inlines.h | |
parent | ea95c0bb6f2763480e1b02e05b32dd096d10c932 (diff) |
linux-generic: buffers: correct segment length calculation for packets
Fix for Bug https://bugs.linaro.org/show_bug.cgi?id=1661
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
Review-and-tested-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/include/odp_buffer_inlines.h')
-rw-r--r-- | platform/linux-generic/include/odp_buffer_inlines.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h index 91e56bd50..74af38b9c 100644 --- a/platform/linux-generic/include/odp_buffer_inlines.h +++ b/platform/linux-generic/include/odp_buffer_inlines.h @@ -182,7 +182,9 @@ static inline void *segment_map(odp_buffer_hdr_t *buf, /* Set seglen if caller is asking for it */ if (seglen != NULL) { buf_left = limit - seg_offset; - *seglen = buf_left < buf->segsize ? buf_left : buf->segsize; + *seglen = buf_left < buf->segsize ? buf_left : + (seg_offset >= buf->segsize ? buf->segsize : + buf->segsize - seg_offset); } return (void *)seg_addr; |