diff mbox

linux-generic: bugfix: correct seglen calculation

Message ID 1420381229-17377-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit aa9bbe1a268f1616c57b2000eecbb517fbd65d81
Headers show

Commit Message

Bill Fischofer Jan. 4, 2015, 2:20 p.m. UTC
seglen computation did not account for seg_offset (problem and fix identified
by Geoffrey Blake).

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/odp_buffer_inlines.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mike Holmes Jan. 6, 2015, 1:14 p.m. UTC | #1
Applied - added Geoffreys sign off to the commit.

On 4 January 2015 at 09:20, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> seglen computation did not account for seg_offset (problem and fix
> identified
> by Geoffrey Blake).
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>  platform/linux-generic/include/odp_buffer_inlines.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/odp_buffer_inlines.h
> b/platform/linux-generic/include/odp_buffer_inlines.h
> index f880445..ade2878 100644
> --- a/platform/linux-generic/include/odp_buffer_inlines.h
> +++ b/platform/linux-generic/include/odp_buffer_inlines.h
> @@ -136,7 +136,7 @@ static inline void *buffer_map(odp_buffer_hdr_t *buf,
>
>         if (seglen != NULL) {
>                 uint32_t buf_left = limit - offset;
> -               *seglen = buf_left < buf->segsize ?
> +               *seglen = seg_offset + buf_left <= buf->segsize ?
>                         buf_left : buf->segsize - seg_offset;
>         }
>
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h
index f880445..ade2878 100644
--- a/platform/linux-generic/include/odp_buffer_inlines.h
+++ b/platform/linux-generic/include/odp_buffer_inlines.h
@@ -136,7 +136,7 @@  static inline void *buffer_map(odp_buffer_hdr_t *buf,
 
 	if (seglen != NULL) {
 		uint32_t buf_left = limit - offset;
-		*seglen = buf_left < buf->segsize ?
+		*seglen = seg_offset + buf_left <= buf->segsize ?
 			buf_left : buf->segsize - seg_offset;
 	}